COSC 1435 Lab 8

Purpose: This lab is to look at ways of using loops.

Due: Before class on April 1, 2013

Requirements: Do the following:

1. Accomplish programming challenge 15, from page 296 of the text. This programming challenge appears easier than it really is; many previous students have had significant problems with this lab. Make sure you follow the instructions completely, including input validation (this is trickier than it appears). We as a group will complete pseudocode for this problem at the beginning of the lab.

2. The program name should be 'lab08-XXX.cpp', where XXX is your initials. I recommend you build this program in stages, as follows:

a. Start with a working program, for example your lab 6 program. Change the name and delete the sections that do not apply, but leave enough that you can compile and test the program.

b. Start by coding the main loop of the program and asking only for the employee number (the program exits, if the employee number is 0). Compile and test this portion of the program. Make sure this part works properly and you can enter multiple employees, print out their employee number, and the program exits when 0 is entered for the employee number.

c. Add validation for the employee number (the employee number cannot be negative). Make sure that the program can not get past this section of code unless the employee number is 0 or positive.

d. Add in each of the other items in the payroll roll, one at a time, including the validation for each number (a number cannot be negative). Make sure each works properly, before going on to the next item.

e. Add the code to check whether the total of the pay items is greater than the gross pay. Compile and test.

f. Add the code to do the totals for gross pay, state tax, federal tax, FICA withholdings, and net pay. Output these values to the screen. Do these totals add correctly, even when an item or items fails validation?

g. Reread all the requirements of the lab and verify your program and submission meets them.

3. One of the key focuses of this program is the user interface. Give careful though to the design of the user interface and make sure it is easy to use for a non-class member (think of one of your grandparents). That includes describing what the program does as part of the output.

4. Try your program with a variety of input values, to determine it works properly.

5. This lab requires a lab report/documentation package. All of these items are not typically in the same file (source code and sample output should definitely be in their own files), but the main lab report file must reference each item by file name. Here is a sample lab report. The main lab report must either be a text file (with a .txt extension) or a Microsoft Word file (with a .doc extension). The lab report must includes the following or references (the file name that was attached to the mail) to the following information:

Program Submission. You will be submitting this lab via Blackboard as you have done in porevious labs. Prepare the following:

  • Your program source code. This file should be called lab07***.cpp, where the *** is replaced with your initials.
  • A copy of your program output saved as a file. This file should be called lab07***.txt, where the *** is replaced with your initials. The .txt signifies that this is an ASCII text file.
  • A lab report as described above. The lab report may be in a Microsoft Word document, with a .doc suffix or an ASCII text file with a .txt suffix. Make sure it contains all of the required items. This file should be called either lab07***doc.txt for a text file or lab07***doc.doc for a Microsoft Word file, where the *** is replaced with your initials.
Grading Criteria: 100 points available for this lab.