Sue's Sundials

Tags
Challenge
No

Sue sells three types of sun dials to retail outlets: standard (price: $189), enhanced (price: $275), and luxury (price: $595).

Each one has a base, a plate, and a gnomon.

  • Standard: base, standard plate, steel gnomon.
  • Enhanced: base, etched plate, steel gnomon.
  • Luxury: base, etched plate, gold gnomon.

Component costs:

  • Bases: $22 each
  • Standard plate: $12 each
  • Etched plate: $21 each
  • Gold plate: $87 each

Write a program where the user inputs the number of each sundial in an order. Assume the user makes no errors in input. The program outputs the total prices Sue charges, the number of each component type needed, and the total cost of each component type. Also output a warning if five or more etched plates are needed, since they tend to crack during assembly, and Sue might have to order some spares.

Here's some sample I/O:

  • Sundial order
  • ======= =====
  • Plain sundials? 1
  • Enhanced sundials? 1
  • Luxury sundials? 1
  •  
  • Prices
  • ------
  • Plain: $189
  • Enhanced $275
  • Luxury: $595
  • -----------------
  • Total: $1059
  •  
  • Components needed
  • ---------- ------
  • Bases (3): $66
  • Standard plates (1): $12
  • Etched plates (2): $42
  • Steel gnomons (2): $36
  • Gold gnomons (1): $87
  • ----------------------
  • Total: $243

Another sample:

  • Sundial order
  • ======= =====
  • Plain sundials? 8
  • Enhanced sundials? 5
  • Luxury sundials? 3
  •  
  • Prices
  • ------
  • Plain: $1512
  • Enhanced $1375
  • Luxury: $1785
  • -----------------
  • Total: $4672
  •  
  • Components needed
  • ---------- ------
  • Bases (16): $352
  • Standard plates (8): $96
  • Etched plates (8): $168
  • Steel gnomons (13): $234
  • Gold gnomons (3): $261
  • ----------------------
  • Total: $1111
  •  
  • Warning: you may need to order spare etched plates.

Format the output as shown, including the right headings, underlines, dollar signs, spacing, and other elements.

The usual programming standards apply.

Upload your solution here, not to Moodle.