Starting from:
$35

$29

Programming Project #4: An Employee Class Solution

Background

This program is the first of a series of three programs that 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 a copy 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 functionality. This set of exercises will give you a glimpse into that process. In this first program you will develop an Employee class. This project is all about properly designing and coding a program that uses a class of your own design that is easy to modify.

Objective

    • Develop object-oriented design skills.

    • 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)
    • address (string)
    • phone (string)
    • hourlyWage (double)
    • hoursWorked this week (double)

Your Employee class will have the following functions:

    1. A constructor for the Employee class that takes arguments to initialize all of the above mentioned data members.
    2. 'Getters' for each data attribute of your class.

    3. Setters for every attribute except employeeNumber. We will not use the setters in this assignment, but in an actual payroll application, employee data, except for the employee number, can change (due to address change, marriage, a raise or promotion etc.).
    4. 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.
    5. A function, printCheck() that prints out a pay check for each employee.

The major function of this first exercise is to test your Employee class. You will upload 3 files:

    1. employee.h

    2. employee.cpp

    3. main.cpp

Your main() function does the following.

    • Creates two Employee objects with data that you can glean from the output below. These objects will be 'hard coded' into your .cpp file. There will be no interactive input for this program.
    • Calls the needed getter member functions to display the employee's name, number, address, and phone, as shown below.

    • Calls printCheck() to print the check, which follows the employee's personal information. Note that printCheck calls calcPay, and prints the whitespace that you see below before and after the check portion.

Submitting Your Assignment

For this assignment you will create and submit 3 files: main.cpp, Employee.h, and Employee.cpp. You will place your Employee class definition in Employee.h. The bodies of the Employee member functions go in Employee.cpp.

Expected output:

Employee Name: Joe Brown


Employee Number: 37

Address: 123 Main St.

Phone: 123-6788


....................UVU Computer Science

Dept.................................


Pay to the order of Joe
$344.38
Brown....................................



United Community Credit Union

................................................................

..............

Hours worked: 45.00

Hourly wage: 10.00





Employee Name: Sam Jones

Employee Number: 37

Address: 45 East State

Phone: 661-9000


....................UVU Computer Science

Dept.................................

Pay to the order of Sam
$271.88
Jones....................................



United Community Credit Union

................................................................

..............

Hours worked: 30.00

Hourly wage: 12.50

More products