Assignment 02

Due: Friday, Sept. 8, 2017 at noon 100 pts

Your program should be "user friendly" in that it should have an opening statement or greeting, user friendly and understandable prompts, and clear and concise outputs and sign-off. Here's a good example of bad output: hello

34

12

3456

0

22

Notice that there are NO prompts to speak of, and the output is completely unexplained. This is horrible output. Something like the following is much much better:

You are using the LENS-O-MATIC program

enter:

left acuity: 34

right acuity: 12

ssn: 3456

ins? 0

thickness of lens: 22 cm

Good luck with those glasses! And come back to see Dr. Nick !

See how much friendlier this is??

When you submit: When you submit this, and all subsequent programs for this class, cssubmit will compile and run (assuming it compiles) your program during the submission process. Thus, when you submit, you will have to enter inputs as a user of the program. Now, in order to make the output uniform for the grader and to keep them sane, ALL OF YOU will enter the same information. For this assignment, it is:

  • left acuity 15

  • right acuity 16

  • last 4 of soc sec 8350

  • yes for ins coverage

As always, if you have any questions about this assignment, be sure to ask your (lecture) instructor.

1We have no idea what this word means. It sounds cool and impressive, and it boosts our esteem to use it; we come off as really smart now. Don't look it up.

LA is left acuity, a positive integer

RA is right acuity, a positive integer

K1 is the index of refraction constant that Dr. Nick has discovered empirically. It's value is the constant integer value 2

K2 is the Nick Needs Money constant which ensures Dr. Nick a minimum income from each customer; currently it is 4.2

The insurance adjustment factor is the second to last digit (the tens digit) of the patient's soc sec number. This factor is added into the thickness computation ONLY IF the patient has insurance. Why? Well, it screws up the prescription and then they have to come back to Dr. Nick for another diagnosis and more new lenses. Hence, Nick can bilk the insurance companies for more money.

Note: The thickness value computed should always be rounded down to the nearest integer value. You are not allowed to use conditional statements (if or if-else) in the program. Think carefully how to use the information you have input from the user, how it is stored, how boolean variables are represented. It is up to you how you want to name your variables and constants. Don't think that you should copy names that your employer/teacher/mentor (see picture above) use to describe a problem. YOU are writing the code.

where thickness is an integer value in cm (centimeters),

thickness = ( 3 + LA / ( RA + K1 ) ) * K2 + insurance adjustment factor

Be sure that only the file you want to submit is in that directory - make a directory for every assignment! Remember that the submit system will deliver every .cpp file in the current directory to me, so you should only have the file for hw 2 in that directory. 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: Hans Moleman needs a new pair of glasses. He's going to try out a new optometrist in town, a Dr. Riviera. He has been involved in "cutting edge" (see pic) research (see other pic) .... which is why he has changed residences and started a new practice in optometry. But I digress. Dr. Nick has developed a new formula for determining the grinding thickness for lenseseses..es. Your program is going to do that computation. Roughly speaking, the thickness of the lenses (both the same for right and left, since Dr. Nick believes in simplicity) is dependent on both left and right visual acuity, some cliometric1 constants, and the patient's social security number. The formula is given below.

Specifications: Your program is to prompt the user for input of the two integers, left acuity (LA) and right acuity (RA), and the last 4 digits of the patient's social security number (this is entered as a single 4-digit integer). Finally, prompt for whether the patient has insurance or not. For this last input, your prompt should request a 0 (for no) and 1 (for yes), and the value be read into a boolean type variable. These inputs are to be used in this formula:

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 1570 section_letter assignment_number