Skip to content

Instantly share code, notes, and snippets.

@Andsbf
Created March 4, 2015 04:37
Show Gist options
  • Save Andsbf/02e32e0fd73f796cadc4 to your computer and use it in GitHub Desktop.
Save Andsbf/02e32e0fd73f796cadc4 to your computer and use it in GitHub Desktop.
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