Assignment 03

Due: Friday, Feb. 13, 2015 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 for this course electronically, from the directory in which the file resides type in at the UNIX prompt the command: cssubmit 1570 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: The last program you wrote for Mr. Jackson, our forensics investigator extraordinaire, was a great help to him. Having to do all that math himself made him sick to the

stomach. He's so happy, he wished you to write another program to help him with perpetrator identification probability calculations. Here's how it works. For certain psychological disorders, the probability of committing a given crime is known (estimated from empirically ergodic data). The probability assignments have been broken down by disorder clusters, personality disorders, and finally subtype feature. A table of these are given below. The probabilities of committing either cannibalism or robbery aregiven in the last two columns.

Specifications: So, your program is to greet the user and then prompt for and input their name. That name is to be used at least once in the following prompts for inputs. Your program is to input the crime you are interested in. The choices of crime are those in the last two columns of the table above. After that, prompt for and input from the user the following information for two suspects: the 'cluster', then the 'disorder', and finally the 'feature'. Your program should then decide, based on the above table of probabilities, which of the two suspects is most likely to have committed that crime. Of course, your output should identify whether the first suspect or the second suspect is "the guy" who done it, and the probabilities that lead to this decision.

Details: It is strongly recommended that your prompts for all the information look something like this:

Enter the crime: (1 for cannibalism, 2 for robbery):

...or

Enter suspect1's cluster (A or B):

...or

Enter suspect2's feature: 1 for Creepy and 2 or Avoidant

In this way, you are asking the user to input either a single character or an integer to indicate their choice. Do not try to input strings to match and make decisions on. That will only lead to heartbreak and despair.....and you will never win the lotto.

After you have input all the necessary information about the crime and the suspects, your code should use decision branching (if - else statements) to determine and output the most likely of the two suspects to have committed the crime. Do not use the switch-case statement in this assignment. You will also be required to write code that insures the user inputs only allowable responses to prompts. That is, if a prompt asks for '1' or '2', and the user of your program inputs '3' or 'x' or whatever, your code should re-prompt the user for the input and continue to do so until a proper response is input.

When you submit: As usual, when you submit, the submit script will compile and run your program during the submission process. You become the user of the program during that submit. In order to unify the outputs for the grader, please input the following:

  1. enter a name of your choice. You can enter "Action" if you can't think of anything else. Remember: no whitespace in the name you enter.

  2. choose robbery for the crime

  3. suspect1 is to be A Schizoid Compulsive

  4. suspect2 is to be B Just a Jerk Weirdo

And, as usual, if you have any questions about the assignment, don't hesitate to ask your instructor of cs 1570. Please don't ask your lab instructor as it is not their job to help you on these 1570 assignments, only their 1580 assignments. You can also obtain help from LEAD. Also, don't eat anyone while coding this program.