Retched River Boat

Challenge
No

You operate the Bloated Badger, a party boat cruising the Retched River. Write a Python program to work out the profit from a trip.

Revenue is from ticket sales. You sell two types of tickets:

  • Hoity-toity: max of 20 per trip. Tickets sell for 52 AP each (Aluminium Pieces, your world's currency).
  • Hoi polloi: max of 50 per trip. Tickets sell for 22 AP each.

Note: It's Aluminium, not Aluminum.

Costs are from fuel, drinks (ale and wine), and bribes.

Fuel

Most of the time, a trip takes 550 flasks of fuel, plus 4 flasks per passenger. So a trip with two passengers would take 558 flasks.

Unless it's winter. You need to add 10% to the fuel then. Winter is in Jan, Feb, November, and December.

Each fuel flask costs 0.8 AP.

Drinks

You serve ale and wine. Each hoity-toity gets two ales and two wines. Each hoi polloi gets one ale, and no wine. Hey, they're hoi polloi.

Ales cost you 0.4 AP each. Wines cost 1.6 AP each.

Bribes

Bribes depend on your destination:

  • Brop: 100 AP
  • Xryl: 120 AP
  • Plip: 170 AP

I/O samples

Here's some sample I/O your program should reproduce:

  • Retched River Boat
  • ======= ===== ====
  •  
  • How many hoity-toity (0 - 20): 1
  • How many hoi polloi (0 - 50): 1
  • Destination (B for Brop, X for Xryl, P for Plip): b
  • Month (1 - 12): 1
  • -------------------
  • Fuel: 614 flasks (491 AP)
  •   Fuel added for cold weather
  • Ale: 3 bottles (1 AP)
  • Wine: 2 bottles (3 AP)
  • Bribes: 100 AP
  •  
  • Total cost: 595 AP
  • Revenue: 74 AP
  • Profit: -521 AP

Match formatting exactly, e.g., the underlines. Round all values to the nearest whole number. (Do all calculations without rounding. Rounding only happens during output, not computation.)

Notice the message in the output showing fuel has been added for the cold weather.

Validate input:

  • Ticket input: integer from 0 to 20 or 50, depending on ticket type.
  • Destination: B, X, or P. Upper- or lowercase accepted. Extra spaces allowed.
  • Month: integer from 1 to 12.

Show appropriate error messages. Keep looping until input is valid.

Here's another output example, with lots of validation error messages.

  • Retched River Boat
  • ======= ===== ====
  •  
  • How many hoity-toity (0 - 20): some
  • Sorry, you must enter a whole number from 0 to 20.
  • How many hoity-toity (0 - 20): ummm... 221?
  • Sorry, you must enter a whole number from 0 to 20.
  • How many hoity-toity (0 - 20): -21
  • Sorry, please enter a number from 0 to 20.
  • How many hoity-toity (0 - 20): 2.33
  • Sorry, you must enter a whole number from 0 to 20.
  • How many hoity-toity (0 - 20): 15
  • How many hoi polloi (0 - 50): 42
  • Destination (B for Brop, X for Xryl, P for Plip): here and there
  • Sorry, please enter B, X or P.
  • Destination (B for Brop, X for Xryl, P for Plip): p
  • Month (1 - 12): maybe next month
  • Sorry, you must enter a whole number from 1 to 12.
  • Month (1 - 12): 6
  • -------------------
  • Fuel: 778 flasks (622 AP)
  • Ale: 72 bottles (29 AP)
  • Wine: 30 bottles (48 AP)
  • Bribes: 170 AP
  •  
  • Total cost: 869 AP
  • Revenue: 1704 AP
  • Profit: 835 AP

One more:

  • Retched River Boat
  • ======= ===== ====
  •  
  • How many hoity-toity (0 - 20): 10
  • How many hoi polloi (0 - 50): 30
  • Destination (B for Brop, X for Xryl, P for Plip): b
  • Month (1 - 12): 11
  • -------------------
  • Fuel: 781 flasks (625 AP)
  •   Fuel added for cold weather
  • Ale: 50 bottles (20 AP)
  • Wine: 20 bottles (32 AP)
  • Bribes: 100 AP
  •  
  • Total cost: 777 AP
  • Revenue: 1180 AP
  • Profit: 403 AP

Other things you should do:

  • Use at least two functions. You can use more if you want. You must include docstrings for every function.
  • Use the IPO pattern. Add comments to your code to show where each part of the pattern starts.

Submit your solution here, not to Moodle. The usual programming standards apply.

Where referenced