//: Playground - noun: a place where people can play

import UIKit

class Shape {
    
    func calcArea() -> Double {
        return 0.0
    }
}

class Rectangle : Shape {
    var width : Double
    var height : Double
    
    init(width : Double, height: Double) {
        self.height = height
        self.width = width
    }
    
    override func calcArea() -> Double {
        return self.width * self.height
    }
}


class Triangle : Shape {
    var width : Double
    var heigth : Double
    
    init(width : Double, height: Double){
        self.width = width
        self.heigth = height
    }
    
    override func calcArea() -> Double {
        return self.width * self.heigth / 2
    }
}

class Circle : Shape {
    var radius : Double
    init(radius : Double){
        self.radius = radius
    }
    
    override func calcArea() -> Double {
        return Double.pi * self.radius * self.radius
    }
    
}


var rect = Rectangle(width: 19, height: 8)
var triangle = Triangle(width: 10, height: 6)
var circle = Circle(radius : 8)


print("rectangtle area : \(rect.calcArea())")
print("triangle  area : \(triangle.calcArea())")
print("circle area : \(circle.calcArea())")
