Due: Friday, Sept. 26, 2014 at noon 100 pts
For this assignment, you will submit a single C++ compilable file containing a program written in C++. Of course, you will submit in the usual (correct) way.
Background: Dr. Eloe, noticing that there are patients without patience in the waiting room, inquires, "What's wrong?" "I want my meds NOW", they cried. They simply didn't they could make it to the pharmacy to get that Schraut® for their diarrhea. The good doctor also noticed that the only vending machines in the waiting rooms were vending soda, candy, cigarettes, and other healthy options. So, why not vend prescriptions. That's where you come into the picture. He wants you to write a program that will emulate the operation of said machine. He wants to call this new contraption the INSTY-MEDS machine - no more fuss and muss with waiting about for a prescription!
Specifications: Your program is to present the user with a menu of choices. The menu should look something like this (and these will be the choices for this program):
INSTY-MEDS
------------------
1. Naprosyn $10.00 (pain relief)
2. Krystexxa $3.50 (relief from gout - I think)
3. Schraut! $4.00 (for relief from diarrhea)
4. Xeljanz $6.75 (relief from Hippopotomonstrosesquipedaliophobia1)
5. Qnasl Dipropionate $12.25 (for the treatment of nasally fitted Q-tips)
6. GoLytely $14.33 (to treat gluttony)
7. Quit
So, the idea here is that your can vend your own pharmaceuticals and not have to bother with all those pharmacists, government regulations, and safety concerns. PPFfffftt! Silly codes.
Details:
You are to use the switch-case statement for your initial " menu" structure. After the main "menu", you can write prompts any way you choose (as a menu or individual prompts).
The 4th and 5th buttons on the machine are broken (by design). Here's how they are to work: if the user chooses Qnasl Dipropionate, they also get GoLytely. If they choose Xeljanz, they get Qnasl Dipropionate and GoLytely also. Nice. They should be billed only for the last item. This is how Dr. Eloe gets rid of old, out-of-date Qnasl and GoLytely.
After the user chooses an option, he/she is presented with the cost and a prompt for payment. Your program will then calculate the change from that payment, or issue an error message and reprompt if the amount tendered is insufficient.
Your program will also tell the vendee (that's the user) how many pills they are getting. This will indicate the minimum size pill container the user should have on hand when the pills that come out of the vending machine. There are a set of standard pill containers available: 10 count, 25 count, 50 count, and 100 count pill containers. Your program is to tell the user which of these to have ready.
Note: Naprosyn is sold 15 at a time; Krystexxa is dispensed 30 units at a time; Shraut! will come in 20 pill lots; Xeljanz is potent and only sold 5 at a time; Qnasl Dipropionate is sold by the duo-score (40); and GoLytely is just one big gulp (only one pill).
After all information is presented to the user, the main menu is to be presented again. 'Quit' will terminate the program. (Assume only one customer is using the program at a time, but they can vend more than one prescription.
Since you will be outputting monetary values, you will want to 'force' the output of exactly 2 decimal places. Just include these three lines of code near the top of your program (after you declarations) and you get just that for the rest of the program (2 places after the dec). It's magic code that we will explain near the end of the semester.
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
Remember: When writing your code, be sure to:
Use meaningful variable names.
Use proper spacing for indentations.
Use constant variable declarations where appropriate.
Include the comment block at the head of your file.
Comment code that needs it.
Be literate in your welcoming/signing-off messages and prompts and output.
Make the output pretty and user-friendly.
Note: Don't underestimate the time that it will take to write this program!
When you submit, the submit script will compile and execute your program in the process. This means that you will be the "user" of the program for that few minutes. Now, in order that the grader isn't driven crazy by a multitude of inputs/outputs, you will ALL input the same values so that he has uniform output to grade. They are:
option 9 (uh, bogus input should beget a error message)
option 2
$5.00
option 5
$10, then $15
quit
Always remember, if you have any questions, be sure to ask and take your Xeljanz regularly.
1Fear of long words
2 Note: No animals were harmed in the preparation of this web page. We made fun of a few medicinal names, only their feelings were hurt. We promise not to do it again.