Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 8.20 Programming Project #4: An Employee Class Background This program is the first of a series of three programs that you will do over

C++

image text in transcribedimage text in transcribedimage text in transcribed

8.20 Programming Project #4: An Employee Class 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 e empNum (integer) name (string) address (string) phone (string) hourlyWage (double) hoursWorked this week (double) Make sure your constructor declares its parameters in the order above 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. They MUST be declared as follows int getEmployeeNumber) const; const std::string& getName) const const std::string& getAddr ) const const std::string& getPhone () consti double getHourlyWage () const; double getHoursWorked () const; 4. Setters for every attribute except empNum. 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.). However, we will Unit Test all Setters, so they MUST be declared as follows void setName (const std::string& name) void setAddr (const std::string& address) void setPhone (const std::string& phone); void setHourlyWage (double wage) void setHoursWorked (double hours); 6. A public 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. NOTE: This MUST be declared as a "public" function for the Unit Testing to properly work. 7. A function, printcheck() that prints out a pay check for each employee. (This should NOT print out the employee's name, number, phone, etc. That is done in main0 using getters.) 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 want to write a function to do this...) and prints the whitespace that you see below before and after the check portion .Calls the needed getter member functions to display the employee's name, number, address, and phone, as shown below. (You might .Calls printCheck() to print the check, which follows the employee's personal information. Note that printCheck calls calcPay For this assignment you will create and submit 3 files: main.cpp, Employee.h, and Employee.cpp. You will place your Employee class declarations in Employee.h. The bodies (the definitions) 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 Pay to the order of Joe Brown.. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . $344.38 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 Pay to the order of Sam Jones....... . . . . . . . . . . . .. . . . . $271.88 . . . . . United Community Credit Union Hours worked: 30.00 Hourly wage: 12.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions