Write a program in C++ that will compute employee's overtime hours worked and the weekly pay. Given are the employee's n

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a program in C++ that will compute employee's overtime hours worked and the weekly pay. Given are the employee's n

Post by answerhappygod »

Write A Program In C That Will Compute Employee S Overtime Hours Worked And The Weekly Pay Given Are The Employee S N 1
Write A Program In C That Will Compute Employee S Overtime Hours Worked And The Weekly Pay Given Are The Employee S N 1 (181.01 KiB) Viewed 53 times
Write a program in C++ that will compute employee's overtime hours worked and the weekly pay. Given are the employee's name, the hours worked during the week and hourly rate. Your program will also find out the highest pay and the average overtime hours of the employees. You were asked to use five arrays to store employee name (empName), hours worked (hour), hourly rate (rate), overtime hour (otHour), and pay (pay). MUST use function prototypes so the functions are placed after the function main(). Without the use of function prototypes, assignment will not be graded and it will worth ZERO. There are 3 employees, so you will use a constant NUM_EMPS equals to 3. Declare this constant: const int NUM_EMPS = 3; // Number of employees Array specifications. Declare these five arrays: employee name number of hours worked in a week hourly pay rate overtime hours weekly pay empName hour rate otHour pay -type string -type int - type double - type int - type double Hours worked over 40 during the week is considered over time hours. Over time hours are paid one time and half (12) of the regular hourly pay. Your program will prompt the Employee name, hour, and rate. Input prompt messages: Employee Name Hours worked during week Hourly rate (After the data entry of each employee, clear the screen)
Use the following functions: 1. This function will get data for the arrays empName, hour, and rate from t 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 function will find out the highest pay earned. high = findHigh (pay, NUM_EMPS); 4. This function will calculate the average of all the overtime hours worked employees. The variable average is declared as data type type double. averageOThour = findAverage (otHour, NUM_EMPS); 5. This function will display the table as shown below, the average pay c highest pay. Display (empName, hour, otHour, rate, pay, average, high, NUM_EN Test data: Name Joe Hill 46 Bill Anderson 50 Susan White 30 Hours Hourly Rate Add these lines above return 0: cout << " Programmer Name: Your name system ("pause"); 15.50 16.25 27.75 All the dollar amounts, and the average overtime hour will be displayed with two after decimal point. " << endl;
system ("pause"); Before displaying the output; use Tips: How to compute the average of the values in a numeric array? Refer - Page 406 of your book. To clear the buffer: Use the following function to clear the buffer after the set of data entry is done inside the loop. If this function is not used, your program will skip the name for the second set of data entry. Display Name cin.ignore(); //clears the buffer for next iteration of getline Joe Hill Bill Anderson Hours 46 50 Susan White 30 Summary: Overtime 6 ...................Blank Line......... Programmer: Your Name 10 ..................Blank Line....................... system("cls"); 0 ....................Blank Line............. Average overtime hours: 5.33 Highest Pay: 893.75 //This will clear the screen Hourly Rate 15.50 16.25 27.75 Pay 759.50 893.75 832.50
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply