Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please in C++ Design a PayRoll class that has data members for an employee's first and last name, hourly pay rate, number of hours worked.

Please in C++
image text in transcribed
Design a PayRoll class that has data members for an employee's first and last name, hourly pay rate, number of hours worked. The default constructor will set the first and last name to empty string, and hours worked and pay rate to zero. The class must have mutator functions to set each of the data members of the class and accessors to access them. The class should also have the following member functions: 1. displayPayroll function that displays all data members of the a PayRoll instance on one line separated by blanks 2. readPayRoll function that reads data members of a PayRoll instance from an input stream associated with a text file (assume all data members are on one line separated by commas) 3. getGross function that will return a double calculated by multiplying the hours worked by the pay rate. Write a program with an array of seven PayRoll objects. The program should read the name (first and last), pay rate and the number of hours for each employee and display each employee information followed by the employee's gross pay, all on one line separated by blanks. Set the precision for printing the doubles to two decimal places. 1. Do not accept values greater than 60 for the number of hours worked, simply have the set function set number of hours worked to 60, the maximum allowed. 2. Do not accept negative values for pay rate and hours worked (set them to 0) 3. Be sure to include an employee claiming to work more than 60 hours per week, negative pay rate, and negative hours worked

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

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago