Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sign shop app
def get_dimension_price
while true
puts "Input banner width in m:"
width = gets.chomp.to_f
break if (width != 0.0 && width < 150) # avoid string input and unreasonable values=a banner bigger than 150m
end
puts "Input banner height in m:"
height = gets.chomp.to_f
width*height*15
end
def get_colour_price
puts "Banner number of colour(s):"
colours = gets.chomp.to_i
return (colours <= 2 ? colours*10 : 15*colours)
end
def sign_shop_app
price = ((get_dimension_price + get_colour_price)*1.15).round(2)
print "Banner total price is: $ #{price}"
end
puts sign_shop_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment