Assignment 03

Due: Friday, Sept. 19, 2014 at noon 100 points

For this assignment, you will submit a single C++ compilable file containing a program written in C++. Remember, to submit a file to for this course electronically, from the directory in which the file resides type in at the UNIX prompt the command: cssubmit 53 section_letter assignment_number. Be sure that only the file you want to submit is in that directory - make a directory for every assignment! The submit system will deliver every .cpp file in the current directory to me. Name your file a meaningful name and give it a .cpp extension since you will be compiling it. Also, make sure that you compile and run your program using the GNU (g++) compiler before submitting to make sure that it will work for the submit script.

Background: Your last assignment was to fulfill a programming contract with the distinguished Dr. Nate Eloe. You did well. You did so well that Dr. Eloe wants more from you. You must understand that Dr. Eloe sometimes has trouble understanding what is a medical emergency and what isn't, and which emergencies are more dire than others. Furthermore, the good doctor has a short memory. He can't remember from one day to the next which of the many traumas that come into the hospital he thinks should be treated before others. So, one day he might find that a razor cut warrants immediate treatment over the severed hand case that came in at the same time, while on another day he deems the loss of limb more important than the cut. He's a bit confused and he needs your programming skills to help him out. Below is a table showing 3 major body regions, each with sub-regions, and injuries associated with those injuries. And, associated with each injury is a ISS value (that's Injury Severity Score). The ISS is meant to be a standard by which a doctor can determine which of two patients should be admitted to the ER first. The contents of this table used to resemble a trauma scoring tableau posted on the web by Trauma.org, but it has been "updated" by Dr. Eloe to encompass injuries that he has encountered and continues to have to deal with. Dr. Eloe will continue to add injuries to this table as his career stumbles into the future.

Specifications: Your program is to greet the user (presumably Dr. Eloe or his nurse, Nurse Ward). It should then prompt for and input the name of the first of two patients. Use the name in the questions to follow. The questions to follow will guide the user through a series of menus to determine first the region of the injury, then the sub-region of the injury, and finally the injury the patient has endured. Once that the injury is identified, the score (ISS) will be recorded. At that point, the second patient is "ushered" through the same process (get their name and present menus for region of the injury, then the sub-region of the injury, and finally the injury) to determine their ISS. Your program will then compare the two ISS values and announce to the user which patient (identified by name) the good doctor will see first. The higher ISS gets the doctor. Now, if the scores are the same, Dr. Eloe's patience will reach its end and he will simply give preference to the patient with the "smallest" name. Uhh, what's that you say? That's right, you can compare string type variables using the < and > operators. The comparison is made character-by-character until a difference is reached and the ASCII value determines the relation. (For example, if str1 is "bob" and str2 is "billy", then the comparison goes to the second char in the strings and str2 (billy) is less than str1 (bob) since i < o, in their ASCII valuation.) If that doesn't break the tie, just take the first patient.....since they are identical for all (medical) purposes.

Details: A "menu" is nothing but a glorified prompt. You use cout statements to present options for the user. Here's an example:

Menu

-------

1. Head & Neck

2. Torso

3. Extremity

4. Not Listed

Your choice (pick a number): _

Given the choice prompt, it is implied that the user must input an integer choice. Using if-elses, your program will branch accordingly to give another menu....and then another....until the user reaches his/her injury.

Details upon Details: First, we'll assume that any patient using this system will make a valid type choice at all menus. For example, in the above menu, assume the user will only enter a 1, 2, 3, or 4. (See note below in red about input checking.) Secondly, at the top level (body region - as in the above menu), if the user's injury is not Head & Neck, Torso, or Extremity, then they should choose option 4 and your program will not present further menus, but give them a ISS value of -1, meaning they will be ignored completely in deference to the guy with the burned toe hair. Dr. Eloe has limited medical acumen and is loathe to deal with such tripe as a broken pelvis, lupus, and arrows-to-the-knee. Go to another hospital! Only the first level menu (as above) is to have the "Not Listed" option. This means that a user getting past the first menu must have one of the injuries above. I know this seems crazy, but it's a dangerous world we live in!

If you look carefully (as you should!) at the table above, you will find that the Head & Neck region leads to sub-regions of Head, Neck, and Face; the Torso region leads to sub-regions of Back, Chest, and Abdomen; and Extremity .... well, you figure out this one. Then, each sub-region will have only the injuries listed above as choices.

You will use CONSTANTS in this assignment. I can count at least 16 constants. Maybe there are more; they are important.

You will use loops in this assignment to check/validate input by the user. For example, when you present a menu with options 1, 2, 3, the you should have code that will accept those (integer) values as input but will reject others, subsequently presenting the menu for a correct input. The use of the necessary loops will be covered on Monday next week. You can write most of the code for this assignment and add the looping in later, if you want to get started now - which is a good idea.

Your final output should be "user friendly", which means it should be presentable in a friendly way for the user. And that means your program should output the more critical patient's name and their ISS value.

When you submit: cssubmit will run the program you submit if it compiles. Thus, you will be the user during the submission process. Now, in order that you (as in you all) don't drive the grader crazy with different inputs to deal with, you will use the following inputs during the submission process:

As always, if you have any trouble understanding this assignment or need help, take two aspirin and ..... or go to the LEAD sessions or ask your instructor for help/clarification. DON'T go to Dr. Eloe; he will NOT help you ... not one bit.

8. .....of course....alien implantation

7. enter Chest

6. enter Torso

5. enter name: Your name (first name - no whitespace)

4. choose deformed plastic surgery

3. choose Face

2. choose Head & Neck

1. enter name: Your instructor's name (use first name only; no whitespace) for cs 1570