Ambassador Toni

Tags
Challenge
No

Toni is producer and ambassador for Nobody Listens to Paula Poundstone. Her apartment has flooded, so she's staying in a hotel with her cat, Mr. Totes.

The hotel has a bar, called The Drunken Bishop, or something like that. Toni is supposed to visit the bar, promote the show, and get some new paid subscribers. (The show is free, but some people support it financially, to keep Toni in nodefridas. OK, maybe not, but it makes for a good programming task, so go with it.) She's supposed to wear her NLTPP sweatshirt.

One time at the Boozy Priest, or whatever it's called, Toni caught Randy's eye. He instantly fell in love, because of course he would.

Write a program to compute the profit or loss from Toni's visits. You can download a starting worksheet. It looks like this:

Start

Users fill in the green fields, and click Run. The inputs are:

  • Number of bar visits, numeric, one or more.
  • Cocktails per visit, numeric, minimum of three. (Not saying Toni has a problem, though Mr. Totes has his own opinion.)
  • Whether Toni wore her NLTPP sweatshirt. Y or N. Allow the user to type upper or lowercase, with leading and trailing spaces, if they want.
  • Number of visits Randy is present, numeric, minimum zero, maximum is the number of bar visits.

Costs

Cocktails cost $12 each.

If Toni wears her sweatshirt, add in laundry cost of $16. There will be stains.

Subscription revenue

If she wears her shirt, people will ask her about NLTPP, and revenue will be $208 per visit. If she doesn't wear it, revenue will be $22 per visit, since nobody knows she produces Nobody Knows, except for people she grabs and shakes after her third cocktail.

Income increases by $122 (old wrong value $175, which is OK too, use either value) each time Randy is there. He's really into Toni.

Here's some sample output:

Output

Output

Output

Output

Clear all output before the program runs. All relevant error messages should show simultaneously. There should be no revenue or profit output if there are any errors.

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

Where referenced