Created
September 2, 2015 01:40
-
-
Save ruxandrafed/e54e5f08ff0f98fda7ec 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
def area_price(length,width) | |
length * width * 15 | |
end | |
def colour_price(colour_count) | |
colour_count <= 2 ? 10 * colour_count : 15 * colour_count | |
end | |
def add_tax(price_without_tax) | |
(price_without_tax * 1.15).round(2) | |
end | |
def price(length, width, colour_count) | |
price = area_price(length,width) + colour_price(colour_count) | |
final_price = add_tax(price) | |
puts "For a banner sign that is #{length} feet long, #{width} feet wide, and has #{colour_count} colors, the price is: #{final_price}" | |
end | |
price(2,3,5) | |
price(2,2,1) | |
price(1,1,1) | |
price(6,5,10) | |
price(6,5,1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment