CS 1401 Assignment #8

Date Assigned: Monday, March 27, 2006 or Tuesday, March 28, 2006.

Due Date: Correspondingly Monday, April 3, 2006 or Tuesday, April 4, 2006 before the beginning of your lab session.

Goals: to learn how to use inheritance to design an application with derived classes.

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: 

1.      Create classes to handle the payroll of a company using inheritance. An Employee should have a name, last name, social security number, and department. In addition a SalariedEmployee should have a weekly salary; an HourlyEmployee should have a wage and a number of hours worked; a CommissionEmployee should have a commission rate and gross sales; and a BasePlusCommissionEmployee should have a base salary; ManagerEmployee is a SalariedEmployee with a bonus; and ExecutiveEmployee is a ManagerEmployee with company stock. Each class should have appropriate constructors, set methods, get methods, and toString methods.

 

2.      Write an application that instantiates objects of each of these classes and outputs all the information associated with each object (including inherited information) using the following sample data.

 

 

Name

Last Name

SSN

Category

Weekly Salary

Bonus

Company Stock

James

Smith

3453-323-1234

Salaried

350.00

 

 

Jane

Doe

8483-832-0913

Salaried

365.00

 

 

Earl

Johnson

3342-758-3243

Manager

640.00

250.00

 

Pearl

Mutter

2321-345-9763

Executive

800.00

430.00

10,000.00

Name

Last Name

SSN

Category

Wage

Hours Worked

 

Peter

Nash

3324-322-4321

Hourly

7.75

15

 

Joseph

Sewell

9883-897-3421

Hourly

7.10

20

 

Anna

Jones

4322-343-1445

Hourly

8.05

18

 

Name

Last Name

SSN

Category

Commission Rate

Gross Sales

Base Salary

Lisa

Lane

3342-339-8839

Commission

15.50 %

4500.00

 

Rose

Peterson

3211-382-8902

Commission

19.5 %

7890.00

 

Samantha

Williams

4322-874-8002

BasePlusComm

8.5 %

12500.00

450.00

Oscar

Bean

8384-883-0987

BasePlusComm

7.9 %

11890.00

395.00

 

 

3.      Compute the weekly payroll of the company using the given data. Your application output should show a company name (that you will define), the date when your lab is due, and the following columns: name, last name, SSN, Weekly Gross, Tax (flat rate of 18.5 %) Weekly pay deposit (computed from the data shown and the flat tax rate).

For extra credit: Generate a csv file to be read with Microsoft Excell using all the columns that employees can have and populating their values based on employee category. Notice that column names that include blank space require special treatment to be read correctly by Excell. Import your csv file into Excell and print the corresponding worksheet.

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.