Assignment 07

Due: Wednesday, March 16, 2016 at noon 100 points

Instructions: You know how to submit; do it in the usual way. However, this time you will submit multiple files for this programming project. The cssubmit script will work as usual, picking up all .cpp and .h files in the current directory. So, make sure you have created a separate directory for your hw 7 program. Do not create subdirectories in the hw7 directory. In fact, don't do that in any of our assignments!

Specifications: You are to create three (3) constant arrays which contain the following:

  • An array of customer names that will contain these 36 names: Barney, Bart, Homer, Lisa, Marge, Chief Wiggum, Ralph, Jimbo, Mr. Burns, Kearny, Smithers, Flanders, Krusty, Jasper, Maggie, Patty, Selma, Kent, Bumblebee man, Doris, Willie, Prof Frink, Dr. Hibbert, Kang, Kodos, Edna, Lenny, Rev Lovejoy, Otto, Hans Moleman, Apu, Quimby, Dr. Nick, Skinner, Brandine, Nelson.

  • An array of ailments containing these 31 ailments: Jaundice, Bounce Eye, Pleurisy, Hangnail, Busted Spleen, Warts, Bad Breath, Stoopititis, Diarrhea, Lice, Drunken Stupor, Tape Worm, Toothache, Fat Head, Small Head, Big Feet, Booger Problems, Hangover, Too Many Arms, Too Few Fingers, Naval Lint, Rotten Teeth, Acne, Neck Crick, Dandruff, a Cold, Mumps, Flu, Rabies, Mad-cow Syndrome, Missing Head.

  • An array of 18 remedies: toothpaste, snake oil, toe jam, stump water, plutonium, terbacker juice, aspirin, moonshine, mudpie, armadillo scales, rendered possum fat, burnt possum hair, drippy possum nose, skunk stink, road tar, mouthwash, more moonshine, earwax.

Your program will contain a struct called patient that will contain member variables for name, ailment, remedy and medical bill with appropriate type assignments for each. Create an array of a maximum of 12 patients who have the potential to enter the clinic and be served. The program (simulation) will first greet the user, then repeatedly query if there are any patients to see the doctor. If not, the program ends. If so, a running count of those who have entered will be kept, and no more than that max number of patients (12) will be allowed to enter. Once a patient "enters", they are assigned at random a name, an ailment, and a remedy by indexing into the appropriate array. Also, a bill of a dollar amount (whole dollars since Cletus can't count change) between and including $5 and $25 will be assigned at random (since Cletus also can't .... well, heck, he pretty much can't do anything!). Output to the screen the patient info, and then query for another patient.

After there are no more patients, or the max number has been reached, output to the screen a list of the patients seen that day in reverse alphabetical (omegabetical) order by name1 (since Cletus is so backwards). So, your output might look like this:

Welcome to Cletus' Healthcare Clinic

Does anyone need to see the doc(y/n)? t

Background: We hardly know what to say. Your software efforts have paid off handsomely for Cletus Spuckler. His self esteem has been so emboldened that he wishes to open a health clinic. He can call it "Doc in a Box", or "The Spuckler Clinic", or "Dr. Cletus Fer Wut Ayles Ya". So, this assignment will have you write a program that will emulate how Cletus will run his "medicine show".

Sweetie, you must enter 'Y' or 'N'! Does anyone need to see the doc(y/n)? y Patient Bart is here complaining of a Toothache. Cletus suggests using some mouthwash for that. That will be $5. Does anyone need to see the doc(y/n)? y Patient Homer is here complaining of a Hangover. Cletus suggests using some moonshine for that. That will be $11.

...

Geez, enuff is enuff! We've seen our limit for the day!

I'm going fishin'...

Cletus' Healthcare Clinic is now closed!

Patients seen today:

Patient Ailment Remedy Bill

------------------------------------------------------------------------------------------

Otto Hangnail toothpaste $23

When you submit: seed your random number generator with the time and run as many patients through as you can. If that exceeds 12, you'd better check your code and the specs on this assignment.

And, as always, if you have questions, ask your instructor and stay away from Cletus's Klinik.

Homer Hangover mudpie $11Bart Toothache aspirin $5

. . .

1For the purposes of this assignment, the first letter of any name in the list of names above is the first letter of the string above. Thus, the first letter of "Bart" is 'B', the first letter of "Homer" is 'H', and the first letter of "Dr. Hibbert" is 'D' not 'H'. I know this is dumb, but separating out Hibbert from Dr. is NOT easy, so don't worry about it. Just omegabetize by the first letter in the names strings.