Bloc Shape Challenge
class Shape
attr_reader :color
def initialize(color)
@color = color
end
def can_fit?(shape)
self.area < shape.area ? true : false
end
def can_fit(shape)
self.area / shape.area
end
end
class Rectangle < Shape
def initialize(width, height, color = "Red")
super(color)
@width = width
@height = height
end
def area
@width * @height
end
end
class Square < Shape
def initialize(side, color = "Red")
super(color)
@side = side
end
def area
@side * @side
end
end
class Circle < Shape
def initialize(radius, color = "Red")
super(color)
@radius = radius
end
def area
@radius ** 2 * Math::PI
end
end