Reference no: EM132164392
Using C++,
Design a class called EmployeeInfo that has the following member variables:
name
hourly rate
number of hours worked
The class has only a default constructor that assigns empty strings ("") to the name and 0 to the hourly rate and number of hours worked.
Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables: getName, getHourlyRate, getHoursWorked, setName, setName, setHoursWorked, and calculatePay. You calculate the weekly pay by multiplying the hourly rate by the number of hours worked (to make it simple, there's no overtime rate).
Demonstrate the class by writing a program that creates one instance of it. Ask the user to enter the employee name, hourly rate and hours worked.
Store them in the object. Display the data and the weekly pay. Exit the program when the user senter "stop."
Input Validation: Do not accept negative alues for the hourly rate and hours worked.
Sample Run Welcome to my payroll program Enter the employee name (stop to exit): John Doe Please enter hourly rate: -2 Invalid hourly rate. Please enter positive numbers only:-1 Invalid hourly rate.
Please enter positive numbers only:20 Please enter the number of hours worked: -5 Invalid amount of hours worked. Please enter positive numbers only:-6 Invalid amount of hours worked.
Please enter positive numbers only:40 Employee Name: John Doe Weekly pay amount : 800.00 Enter the employee name (stop to exit): Henry Smith Please enter hourly rate: 10 Please enter the number of hours worked: 20 Employee Name: Henry Smith Weekly pay amount : 200.00 Enter the employee name (stop to exit): stop