Assignment 03

Due: Thursday, Feb. 3, 2011, at noon 100 points

For this assignment, you will submit a single C++ compilable file containing a program written in C++. Remember, to electronically submit a file to for this course, first change to the directory in which the file resides and then 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: As some of you might know, Jerry Garcia was the lead guitarist for the Grateful Dead. He died in 1995, but we're not going to acknowledge that fact and go on the belief that he is still alive and well ... and in need of your assistance. Jerry usually has a hair problem. Everyday when he wakes up in the afternoon, he just doesn't know what to do with it! But he's learned, through experimentation (something he was very good at) , that his set of hair brushescan guide him successfully through his busy day. His problem is that the fog left in his mind after a long night/morning of playing his guitar for various bands, prevents him from making wise decisions when tending to his hair and overall appearance. You will write a program to help out.

Jerry has determined that the 5-digit number stamped on the handle of each brush will fairly accurately determine what he should be doing with his daily prep. But it's a little complicated and he wants a little program that will help him through his decisions.

Specifications: Your program is to prompt for and read in from the user (presumed to be Jerry, but maybe not) the five-digit styling number (SN) printed on the brush handle. From this information you will use the following guide to output an appropriate message to the user informing them a course of action:

  • Let the 5-digit SN be represented as abcde (e - units, d - tens, etc).

Once your program has determined which case fits, it should echo the input SN and a friendly message informing the user of the correct course of action. Make your output "user friendly" and don't forget a sign-off message.

Notes:

  • the styling number is to be read in as an integer.

  • you can assume that value will be positive

  • you can not assume the entered value will be five-digit, so you must ensure that the user enters a 5-digit integer before proceeding

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.

  • NOT use the switch-case statement. Besides, we haven't covered it yet.

When you submit the submit script will (attempt to) 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. The value to enter during submission is:

  • 63723

As always, if you have questions, don't hesitate to ask your instructor or the tutor in the lab in the evenings.