Coffica Galactica

Challenge
No

Glorpooroo runs Coffica Galactica, a small shop on concourse C of Minoan space elevator 6. Write a program to work out the price for an order.

There are three drink sizes: mega, giga, and terra. The base price of a megas is 4 credits, gigas 8 credits, and terras 16 credits. (Glorpooroo has a thing for powers of two.)

Glorpooroo adds two mixins: mercurino and poloniyum. Customers can order from 0 to 3 shots of mercurino, and 0 to 4 shots of poloniyum. Mercurino costs 1 credit per shot. Poloniyum costs 2 credits per shot.

Customers must give a name to call when the order is ready. Any name of at least two characters is fine.

Here's some I/O.

  • Coffica Galactica
  • ======= =========
  •  
  • Size (M, G, or T): m
  • How many mercurino shots (0 to 3)? 1
  • How many poloniyum shots (0 to 4)? 1
  • Name for the order: Filtak 3
  • Price: 7
  • Order for Filtak 3!

Upper/lowercase doesn't matter for drink sizes. Extra spaces are OK, e.g., " M " counts as "M".

All numeric inputs are integers. Glorpooroo don't hold with no fractions.

Names should be stripped of spaces at the front and back. They can have any characters beings can type.

Use at least three functions. You can use more. Add appropriate docstrings to each one.

Add a programming joke in comments somewhere. People do this sometimes.

Another I/O sample:

  • Coffica Galactica
  • ======= =========
  •  
  • Size (M, G, or T): really big!
  • Please enter a valid size.
  • Size (M, G, or T): T
  • How many mercurino shots (0 to 3)? not too many
  • Please enter a whole number from 0 to 3.
  • How many mercurino shots (0 to 3)? -33
  • Please enter a whole number from 0 to 3.
  • How many mercurino shots (0 to 3)? 2.3
  • Please enter a whole number from 0 to 3.
  • How many mercurino shots (0 to 3)? 2
  • How many poloniyum shots (0 to 4)? 55
  • Please enter a whole number from 0 to 4.
  • How many poloniyum shots (0 to 4)? 3
  • Name for the order: Q
  • Please enter a name of at least two characters.
  • Name for the order: Qintas╜
  • Price: 24
  • Order for Qintas╜!

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

Where referenced