Skip to content

Instantly share code, notes, and snippets.

@vidmantas
Created November 20, 2014 10:30
Show Gist options
  • Save vidmantas/16f65c4cb0f05cf4768f to your computer and use it in GitHub Desktop.
Save vidmantas/16f65c4cb0f05cf4768f to your computer and use it in GitHub Desktop.
#1 užduotis
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