CIS-213 INTRODUCTION TO PROGRAMMING LOGIC II Spring 2008

USING THE C++ LANGUAGE

**************************************************

* *

* The first project will be due on (about 2 weeks) *

* *

* *

* Have your materials ready in a folder on the due date *

* *

**************************************************

Program # 1 is basically a review of several concepts covered in CIS-113. We will use a text file as input to create a payrollreport. Throughout our C++ code , we will make use of Functions to generate the output necessary to produce a payroll report for each person on the input file.

After you have successfully compiled and executed your program, you need to hand in the following materials in your folder:

(1) a listing of your source code

(2) the results of your program

(3) your data dictionary

(4) a program flowchart and pseudocode

(5) hand calculations

(6) layout

PROGRAM SPECIFICATIONS FOR PROGRAM # 1

INPUT:

The name of the input file is: PAYROLL.TXT

The input record layout for Program # 1 is listed below:

LAST NAME is a 12 character string

DEALERSHIP is a 10 character string

BASE PAY RATE is a floating point decimal number

NUMBER OF CARS SOLD is an integer number

EXEMPTIONS is an integer number

HEALTH CODE is an integer number

CIS-213/Program # 1/Page 2

FORMULAS (ALGORITHMS):

1. Gross Pay will be calculated by adding a person’s base pay together with the commissions he or she

earned for the pay period. Commissions are based on the following table.

Cars sold Commission

0 0.0

1-3 10% X Base Pay

4-7 20% X Base Pay

8-10 30% X Base Pay

11-14 40% X Base Pay

2. Federal income tax will be computed as being 28% of the Gross Pay if the number of exemptions

is 0, 20% if the exemptions are 1 or 2 or 3, and 14% if the number of exemptions is more than 3.

3. State tax will be 5% of the Gross Pay if the exemptions are 0, 1, or 2 and 4% if exemptions are

more than 2. (Max. of 5, Use a switch statement)

4. FICA (Social Security Tax) is computed as being a straight 7.25% of a person's Gross Pay.

5. Health Insurance is computed as follows: (Use a switch statement)

Health Code = 1 --- Low option single - 40.00

Health Code = 2 --- Low option married - 55.00

Health Code = 3 --- High option single - 60.00

Health Code = 4 --- High option married - 75.00

6. A person’s IRA contribution is based on his or hers gross pay. If a person’s gross pay is less than

$400.00 a pay period, the IRA contribution is equal to 3.00% of a person’s gross pay. If a person’s

gross pay is between $400.00 and $600.00, the IRA is 5.00% of a person’s gross pay and finally, if a

person’s gross pay is over $600.00, his or hers IRA deduction is 7.00% of the gross pay.

7. Net Pay is a person's Gross Pay minus all of the deductions listed above.

8. Each of the above steps should be placed in separate Functions and executed in turn.

CONSTRAINTS:

After you open your input file, you will need to test to make certain that the data is on drive A: (or

your current drive) and that the name of the file is spelled correctly. If the file can not be found,

display a message that states “There is a problem locating the input file” and then “exit” the

program. Trying to executing a program without data doesn’t make much sense !!!

CIS-213/Program # 1/Page 3

OUTPUT:

Listed below is a sample of what your output may look like after you execute (run) your program.

PAYROLL REPORT FOR THE PAY PERIOD ENDING: 2/8/2008

PREPARED BY: PUT YOUR NAME HERE Page No. n

Employee Dealership Base Pay Commissions Gross Pay Deductions Net Pay

Name Name

xxxxxxxxxx xxxxxxxxxxxx nnnn.nn nnnn.nn nnnn.nn nnn.nn nnnn.nn

xxxxxxxxxx xxxxxxxxxxxx nnnn.nn nnnn.nn nnnn.nn nnn.nn nnnn.nn

xxxxxxxxxx xxxxxxxxxxxx nnnn.nn nnnn.nn nnnn.nn nnn.nn nnnn.nn

xxxxxxxxxx xxxxxxxxxxxx nnnn.nn nnnn.nn nnnn.nn nnn.nn nnnn.nn

Total Net Pay = nnnnn.nn

OTHER PROGRAM CONSIDERATIONS:

When you set up your report, place only 4 detail lines per page. After the fourth detail line has been printed, skip to the top of the next page. There should be an escape character for “form feed” that should work on the printers in lab. If not, we will at least code the program as if the “form feed” was indeed available on our system.

At the top of each page, place the appropriate page number. For example, for page one, you should print out Page No. 1; for page two, you should print out Page No. 2, etc., etc.

Double space each detail line for readability.