CS 1401 Assignment #6

Date Assigned: Monday, March 6, 2006 or Tuesday, March 7, 2006.

Due Date: Sunday, March 12, 2006 by email.

Goals: to learn file objects and looping statements.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

Assignment:  Payroll information for ACME Inc. is stored in file acme_payroll.dat. In this file, every odd line contains an employee id number and name and every even line contains the employee monthly salary. 

For example, for two employees, the corresponding file lines will be:

000123 Donald Trump

1200343.5

000145 Donald Duck

0.25

Design an Employee class to store employee data. Write an application that creates Employee objects with data read from the acme_payroll.dat file, and then prints a table that describes:

For example, for the above-described file, your program should print the following:

Name:                  Yearly Salary:
-----------------------------------------
Donald Trump             14404122.00
Donald Duck                     3.00
-----------------------------------------
Yearly Payroll:          14404125.00
Payroll after 3% raise:  14836248.75
 

Create your own file with 6-8 lines of information, and test your program on this file.

For extra credit: Create a mail merge application that reads a letter saved in file letter_gen.txt and replaces the fields $NAME$, $LASTNAME$, and $TITLE$ with corresponding information typed in by the user. For instance, if the file letter_gen.txt has the following:

-----------------------letter_gen.txt file --------------------------------------

$NAME$ $LASTNAME$

$TITLE$

Dear $NAME$:

        We are pleased to inform you that you just won the Publisher’s Cryinghouse Price for this month!

The IRS will be contacting you shortly.

Congratulations!

Sincerely,

      John Doe.

      CEO, COO, CFO, Publisher’s Cryinghouse, Inc.

----------------------- End of letter_gen.txt file --------------------------------------

 and the user enters Joe, Lucky, Employee Leader when prompted, then your mail merge program should create the mail.txt output file containing:

-----------------------mail.txt file --------------------------------------

Joe Lucky

Employee Leader

Dear Joe:

        We are pleased to inform you that you just won the Publisher’s Cryinghouse Price for this month!

The IRS will be contacting you shortly.

Congratulations!

Sincerely,

      John Doe.

      CEO, COO, CFO, Publisher’s Cryinghouse, Inc.

----------------------- End of mail.txt file --------------------------------------

Please note that you will only be given credit for the extra credit assignment if your main assignment works.

Deliverables: as announced in the labs and explained in the handouts given to you in the labs.