Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program which uses the following arrays: empID : An array of 7 integers to hold employee identification numbers. The array should be initialized

Write a program which uses the following arrays:

empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7.

Hours: an array of seven integers to hold the number of hours worked by each employee.

payRate: an array of seven doubles to hold each employees hourly pay rate.

Wages: an array of seven doubles to hold each employees gross salary.

The program should display each employee number and ask the user to enter that employees hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employees identification number and gross wages.

Input validation: pay rate must be greater than or equal to $5 but less than or equal to $15

Input validation: hours worked must be greater than 0 but less than or equal to 40

Input validation: no garbage or blanks allowed for pay rate or hours worked

No global variables

No labels or go-to statements

No infinite loops, examples include:

for(;;)

while(1)

while(true)

do{//code}while(1);

No break statements to exit loops

using this format

#include

#include

#include

using namespace std;

// Constant for the array size.

const int EMPLOYEE_SIZE = 7;

// Function Prototypes

void getEmployeeInfo(int empId[], int hours[], double payRate[], double

wages[], int EMPLOYEE_SIZE);

void displayWages(int empId[], double wages[], int EMPLOYEE_SIZE);

void validateHoursWorked(string& str1, int& userNumber);

void validatePayRate(string& str1, double& userNumber);

int main()

{

// declare Array of employee ID numbers

// declare Array to hold the hours worked for each employee

// declare Array to hold the hourly pay rate for each employee

// declare Array to hold the gross wages for each employee

// Get the employee payroll information and store it in the arrays.

// call the function getEmployeeInfo

// Display the payroll information.

// call the function displayWages

system("pause");

return 0;

}

//function defitions

// ********************************************************

// The getEmployeeInfo function receives four parallel *

// arrays as arguments. The 1st array contains employee *

// IDs to be displayed in prompts. It asks for input and *

// stores hours worked and pay rate information in the *

// 2nd and 3rd arrays. This information is used to *

// calculate gross pay, which it stores in the 4th array. *

// ********************************************************

void getEmployeeInfo(int empId[], int hours[], double payRate[], double

wages[], int EMPLOYEE_SIZE)

{

}

// ********************************************************

// The displayWages function receives 2 parallel arrays. *

// The first holds employee IDs and the second holds *

// employee gross pay. The function displays this *

// information for each employee. *

// ********************************************************

void displayWages(int empId[], double wages[], int EMPLOYEE_SIZE)

{

}

// ********************************************************

//The validateHoursWorked fuction receives a string and *

//returns an integer. The hours worked must be greater *

//than 0 but less than or equal to 40 *

// ********************************************************

//=================================================

void validateHoursWorked(string& str1, int& userNumber)

{

}

// ********************************************************

//The validatePayRate fuction receives a string and *

//returns a double. The pay rate must be greater *

//than or equal to 5 but less than or equal to 15 *

// ********************************************************

void validatePayRate(string& str1, double& userNumber)

{

//hint: just as there is an stoi, theres is an stof (string to float) and

an stod (string to double)

}

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

What are the purposes of collection messages? (Objective 5)

Answered: 1 week ago