Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: Compute Employee Pay Due:____ Write a program in C++ that will compute employee's overtime hours worked and the weekly pay. Given are the employee

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Assignment: Compute Employee Pay Due:____ Write a program in C++ that will compute employee's overtime hours worked and the weekly pay. Given are the employee 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). 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: empName hour rate employee name number of hours worked in a week hourly pay rate overtime hours weekly pay -type string - type int - type double -type int - type double otHour pay Any hours worked over 40 during the week is considered over time hours. Over time hours are paid one time and half (1 %) of the regular hourly pay. Your program will prompt the Employee name, hour, and rate. Input prompt messages: Employee Name Hours worked during weck Hourly rate (After the data entry of each employee, clear the screen) Use the following functions: MUST use function prototypes so the functions are placed after the function main(). 1. This function will get data for the arrays empName, hour, and rate from 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 function will find out the highest pay earned high - find High (pay, NUM_EMPS) 4. This function will calculate the average of all the overtime hours worked by the employees. The variable average is declared as data type type double averageoThour - find Average ottour, NUM_EMPS) 5. This function will display the table as shown below, the average pay and the highest pay Display (empName, hour, otHour, rate.pay, average, high, NUM_EMPS) Test data: Name Hours Hourly Rate 45 15.30 Joe Hill Bill Anderson Susan White 50 16.25 30 27.75 All the collar amounts and the average overtime hour will be displayed with 2 digits aflet decimal point. Add these lines above return 0: cout #include using namespace std; //Function prototypes void getData(int[], double[], int); void calculate(const int , const double[], double[], int); double highpay (const doubleli, int); void display(const intil, const doublel), const doublet), double, int); int main() { const int NUM EMPLOYEES = 3; 1/ Number of employees int hours[NUM EMPLOYEES); // Array holds hours double payRate [NUM_EMPLOYEES); // Array holds pay rates double grossPayI NUM_EMPLOYEES]; // Array holds gross pay double high; 17 variable holds high pay getData(hours, payRate, NUM EMPLOYEES); //Function call calculate(hours, payRate, grossPay, NUM EMPLOYEES); //Function call high-highpay ( grossPay, NUM EMPLOYEES): //Function call display(hours, payRate, grosspay, high, NUM_EMPLOYEES); system("pause"); return 0; } void getData(int hourst), double payRate[], int NUM_EMPLOYEES) //Function puts values in the arrays - hours and payRate I/Arrays are transferred as parameters { // Input the hours worked and the hourly pay rate. cout > payRate[index]; } void calculate (const int hours(), const double payratet. double grossPayl], int NUM_EMPLOYEES) //Function computes gross pay and stores in grossPay array 1/Arrays are transferred as parameters - hours and 1/payRate are declared as const so no change can be made { for (int index = 0; index double highpay(const double grosspayl], int NUM_EMPLOYEES) //Function finds out highest pay { double highPay; highPay - grossPay(0); for (int index = 1; index highPay) highPay - grossPay[index); return highPay; } void display(const int hours, const double payRatel), const double grossPay), double high, int NUM_EMPLOYEES) { // Display each employee's gross pay and the highest pay system("cls"); cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions