Question: Write a program that uses a value return function called Salary that takes three inputs: hours, wage Rate and overtime Rate and computes and returns
- Write a program that uses a value return function called Salary that takes three inputs: hours, wage Rate and overtime Rate and computes and returns the salary by using the traditional formula:
salary = hours * wage Rate if hours is less than or equal to 40, otherwise,
salary = 40 * wage Rate + (hours 40) * overtime Rate
In main, call this function from a loop to compute salary of 10 employee is by passing each employees hours, wage Rate and overtime rate.
Store these inputs in a text file called employeeInfo.txt (This is similar to one of the lab).
You need to use file input and output,
So, in the main, declare a variable for number of employees, and read that data from user first. Then design any type of loop, from count = 1 to no of employees, and in the body of the loop, read the data from the input file for each employees hour, wage Rate and overtime Rate, and then compute the salary for each employee by calling the function Salary with appropriate input. Then display the hours, wage rate and employee salary for each employee. The output must be displayed on the screen as well as save in an output file.
attach three files: source code (.cpp file), input file (employee.txt) and output file (salary.txt)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
