What is the code for this program?
Last Project: Computer Science I (COSC112.002) Due Tuesday, Dec. 3
A company has a group of employees who are paid hourly and you are given a data file contains that
Names (First, Last), Total Weekly Working Hours, and the Position (is an integer number from 1 to 7) of
each employee. You are asked to write a program that computes each employee’s weekly income. The
program then outputs the names (First, Last), the weekly pay, and the string of the position of each
employee. If the number of hours worked in a week is more than 40 hours, then the pay rate for the hours
over 40 is 1.5 times the regular hourly rate. Use arrays: Two one-dimensional arrays to store the names
(First, Last) of all the employees, a one-dimensional array to store the hourly pay rate, a one-dimensional
array to store the total income, a one- dimensional starting array to store the position.
Your program must contain at least the following functions:
• A function to read the data from a file (“EmployeesIN.txt”) into arrays (you need 4 arrays- a string array for first name, a string array for last name, a double array for working hours, an
integer array for the position), Use while loop and EOF to read data from the file.
• A function that receives working hours and the position then calculates and returns the total income by following formulas:
BaseHours = 40.0;
HourlyRate = (CEO = 40.0, COO = 30.0, CFO = 25.0, Manager and Leader = 20.0,
Secretary and Staff = 15.0);
MainIncome = BaseHours * HourlyRate ;
Overtime = (TotalHours – BaseHours ) * HourlyRate *1.5;
TotalIncome = MainIncome + Overtime;
• A function that receives the position in integer then returns the string of positions, the numbers represent the position are (1 = CEO, 2 = COO, 3= CFO, 4 = Manager, 5= Leader, 6= Secretary,
and 7= Staff). Use SWITCH to do that.
• A function to output the names (First, Last) of all the employees, the total income, and the string of position on the screen.
• A function to output the names (First, Last) of all the employees, the total income, and the string of position on a File “EmployeesOut.txt”
• the main function to call the previews functions
- Write a report, using Word, to analyze the project functions by writing the pseudocode for
the project and submit it on the BLACKBOARD.
- Submit the source file on the Student Share Drive.
Example of input file:
Alin John 67 2
Example of output on the screen and the file:
Name Total Income Position
Alin John 2415.00 COO