Assignment: Compute Employee Pay using arrays and pointers (Make the changes in your Assignment 5 so that arrays are tra
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Assignment: Compute Employee Pay using arrays and pointers (Make the changes in your Assignment 5 so that arrays are tra
Assignment: Compute Employee Pay using arrays and pointers (Makethe changes in your Assignment 5 so that arrays are transferred tothe functions as pointer variable parameters and the items of thearrays are accessed using pointer variables inside the functions.)(See the sample program - Pr7-12 Modified with Functions usingPointers) (It will worth ZERO, if pointers are not used in yourprogram as stated above) Write a program in C++ that will computeemployee’s overtime hours worked and the weekly pay. Given are theemployee’s name, the hours worked during the week and hourly rate.Your program will also find out the highest pay and the averageovertime hours of the employees. You were asked to use five arraysto store employee name (empName), hours worked (hour), hourly rate(rate), overtime hour (otHour), and pay (pay). MUST use functionprototypes so the functions are placed after the function main().Without the use of function prototypes, assignment will not begraded and it will worth ZERO. There are 3 employees, so you willuse a constant NUM_EMPS equals to 3. Declare this constant: constint NUM_EMPS = 3; // Number of employees Array specifications.Declare these five arrays: empName - employee name - type stringhour - number of hours worked in a week - type int rate - hourlypay rate - type double otHour - overtime hours - type int pay -weekly pay - type double Hours worked over 40 during the week isconsidered over time hours. Over time hours are paid one time andhalf (1 ½) of the regular hourly pay. Your program will prompt theEmployee name, hour, and rate. Input prompt messages: Employee Name: Hours worked during week : Hourly rate : (After the data entry ofeach employee, clear the screen) Use the following functions: 1.This function will get data for the arrays empName, hour, and ratefrom the user interactively. getData (empName, hour, rate,NUM_EMPS); 2. This function will compute over time hours and pay.calculate (hour, rate, otHour, pay, NUM_EMPS); 3. This functionwill find out the highest pay earned. high = findHigh (pay, NUM_EMPS); 4. This function will calculate the average of all theovertime hours worked by the employees. The variable average isdeclared as data type type double. averageOThour = findAverage(otHour, NUM_ EMPS); 5. This function will display the table asshown below, the average pay and the highest pay. Display (empName,hour, otHour, rate, pay, average, high, NUM_EMPS);