Wellermen

Challenge
No

There once was a ship that put to sea
The name of the ship
Was the Billy o' Tea
The winds blew hard
Her bow dipped down
O blow, my bully boys, blow
Huuh!

Soon may the Wellerman come
To bring us sugar and tea and rum
One day, when the tonguin' is done
We'll take our leave and go.

Make a program to take orders for the Weller Brothers, a whaling supply company in New Zealand. We'll only have the most important supplies: sugar, tea, and rum. We'll make the measurement units easier to deal with as well. Because, sanity. They used units like bushels in those days. You wouldn't believe the twisted currency system.

There are bulk discounts.

  • Sugar is $1.8 per kilo for less than 10 kilos, $1.6 for less than 50, and $1.4 for 50 or more.
  • Tea is $5.2 per kilo for less than 5 kilos, $5.1 for less than 10, and $4.8 for 10 or more.
  • Rum is $6.7 per liter for less than 20 liters, $6.4 for less than 50, and $6.2 for 50 or more.

Output the price for each item, and the total.

Also, output "You're gonna need more rum, mate!" if the number of liters of rum is less than the sum of the number of kilos of tea and sugar. E.g., if rum is 20, tea is 12, and sugar is 10, output the message. If rum is 25, tea is 12, and sugar is 10, do not output the message.

I/O sample:

  • Weller Bros Order Form
  • ----------------------
  •  
  • How many kilos of sugar? 1
  • How many kilos of tea? 1
  • How many liters of rum? 1
  •  
  • Sugar total: 1.8
  • Tea total: 5.2
  • Rum price: 6.7
  •  
  • Total price: 13.7
  •  
  • You're gonna need more rum, mate!

Another:

  • Weller Bros Order Form
  • ----------------------
  •  
  • How many kilos of sugar? 10
  • How many kilos of tea? 10
  • How many liters of rum? 20
  •  
  • Sugar total: 16.0
  • Tea total: 48.0
  • Rum price: 128.0
  •  
  • Total price: 192.0

Notes:

  • Assume all user input is correct. Validation is the next part of the course.
  • Users might input fractional amounts, like 3.8 kilos.
  • Output the blank lines, the underline, and the prompts exactly.
  • Add IPO comments.
  • Hint: I had a variable named sugar_price_per_kilo. You don't have to.

Upload your solution here, not to Moodle. The usual coding standards apply.

Where referenced