Created
November 20, 2014 10:30
-
-
Save vidmantas/16f65c4cb0f05cf4768f to your computer and use it in GitHub Desktop.
#1 užduotis
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 House | |
def initialize(floors, width, height) | |
@floors = floors | |
@width = width | |
@height = height | |
end | |
def floors | |
puts @floors | |
end | |
def volume | |
total = @width * @height * @floors * 3 | |
puts "Volume is #{total} cubic meters." | |
end | |
def needs_elevator? | |
if @floors > 1 | |
puts "Yes" | |
else | |
puts "No" | |
end | |
end | |
end | |
house = House.new(2, 4, 5) | |
house.floors | |
house.volume | |
house.needs_elevator? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment