Mighty Mary's Smash Hut

Tags
Challenge
No

Mary owns Mighty Mary's Smash Hut, a boxing school in Rochester Hills. She has a special offer, an intro to face smashing course, at a special price. Even cheaper if you have a Groupon. Write a program to compute the price of an order. You can download a starting workbook.

Here's the starting worksheet:

Start

Input:

  • People, from 1 to 4.
  • Groupon, y or n.
  • Rent headgear, y or n.
  • Rent body pads, y or n.

Make sure the user is allowed to type in upper- or lowercase letters for the Y/N fields, with extra spaces at the beginning and/or end of their input.

Validate the input, showing appropriate error messages, using the advanced validation pattern. That is, all errors should be shown onscreen at the same time, like this:

Errors

Make sure error messages and output are cleared when the program runs.

The price is computed as follows:

  • The base price per person is $99 with a Groupon, or $250 without one.
  • Headgear rental costs $20 per person, whether or not there is a Groupon.
  • Body pads rental cost $30 per person, whether or not there is a Groupon.

If the user says they don't want headgear and/or body pads (either or both), show a warning below the price.

Here's some output:

Output

Here's some more:

Output

The usual programming standards apply, including the secluded Cells rule.

Upload your solution to this site, not to Moodle.

Where referenced