Created
October 27, 2015 00:16
-
-
Save kkchu791/09eb9d37bb4715166cb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rectangle | |
attr_reader :width, :height | |
def initialize (width, height) | |
@width = width | |
@height = height | |
end | |
def area | |
area = width * height | |
end | |
def perimeter | |
perimeter = (width + height)*2 | |
end | |
end | |
r = Rectangle.new(23.45, 34.67) | |
puts "Area is = #{r.area}" | |
puts "Perimeter is = #{r.perimeter}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oops.