Project #4 Solution

$30.00 $24.90

Description

Background

This program is the first of a series of three programs that will you will do over the course of the semester that deal with a payroll application. When you are done with this project, be sure to put it in a safe place because you will use it later. Modern software development is very much an incremental and iterative process. Programs are developed a piece at a time as their developers iterate on the design, refactor existing code, and add new function. This set of exercises will give you a glimpse into that process. In this first program you will develop an Employee class and test it with a simple driver program. This project is all about properly designing and coding a program that uses a class of your own design and that is easy to modify.

Objectives:

Refine your object oriented design skills.
Give you practice drawing a class diagram.
Create the proper structure and code for a C++ program containing a class of your design.
Create a driver program to test your class.
The Employee Class

For this project you need to design an Employee class. Your Employee class should have the following data members:

employeeNumber (integer)
name (string)
street address (string)
phone number (string)
hourly wage (double)
hours worked this week (double)
Your Employee class will have the following functions:

A constructor for the Employee class that takes arguments to initialize all of the above mentioned data members.
Getters for each attribute of your class.
Setters for each attribute of your class except the employee number (this never changes).
A function, calcPay( ) that calculates and returns an employee’s net pay. An employee’s gross pay is calculated by multiplying the hours worked by their hourly wage. Be sure to give time-and-a-half for overtime (anything over 40 hours). To compute the net pay, deduct 20% of the gross for Federal income tax, and 7.5% of the gross for state income tax.
Before you write any code, create a class diagram for this class. You will include your class diagram when you submit this assignment.

The Driver

The major function of the driver is to test your Employee class. By no means is it a complete, polished application. Such a driver is common when doing iterative development. In this project, you will create a .cpp file that contains your driver code and a stand-alone printCheck( ) function.

The printCheck( ) function is not a member of any class. It will output the employee’s name, the employee’s net pay for this pay period, the hours worked by the employee, and their hourly wage. The function should output these in a rough simulation of a paycheck and paystub, as illustrated in the sample output below.

Your driver will contain a main( ) function that does the following. You may use this description as your pseudo-code:

Create an Employee object for an employee whose hourly wage is $10.00, and who has worked 45 hours. Use your imagination to come up with your employee’s name and other employee information.
Create a second employee object for an employee whose hourly wage is $12.50 and who has worked 30 hours.
Call your printCheck( ) function, passing the first Employee object as the argument.
Submitting Your Assignment

After you are satisfied that your program works correctly, submit it to Canvas as project #4. Create a zip file for this project and include the following:

The source code for your driver.
A screen shot of your execution results.
Submitting Your Assignment

After you are satisfied that your program works correctly, submit it to Canvas as project #2. Create a zip file for this project and include the following:

A PDF file containg your class diagram.
The source code for Employee.h and Employee.cpp.
The source code for your driver.
A screen shot of your execution results.
Grading Guidelines

Description Points possible Your points
Assignment meets the submission guidelines.
Source code files contain a declaration that you did not copy any code.
Project meets style guidelines.
All source code files contain a file prologue
All methods have a complete method prologue
Code is properly documented
6
Submission includes a properly drawn class diagram for your Employee class.

6
The Employee class in your program matches your class diagram and provides all of the data and functionality described here.

6
Your program contains a stand-alone printCheck( ) method that displays the pay information in a simple simulation of a paycheck and a pay stub, as shown. The printCheck function takes an Employee object as a const reference parameter.

6
The driver creates two Employee objects, as directed. The program works correctly and produces the correct output for the two Employee obejcts.

6
-Late penalty (-20% per day)

Total 30