Hello I need help with C program that calculates hourly wage

Hello,

I need help with C++ program that calculates hourly wage of 7 employees using parrallel arrays

1. 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.
2. Hours: an array of seven integers to hold the number of hours worked by each employee.
3. payRate: an array of seven doubles to hold each employee’s hourly pay rate.
4. Wages: an array of seven doubles to hold each employee’s gross salary.
5. The program should display each employee number and ask the user to enter that employee’s 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 employee’s identification number and gross wages.
6. Input validation: pay rate must be greater than or equal to $5 but less than or equal to $15
7. Input validation: hours worked must be greater than 0 but less than or equal to 40
8. Input validation: no “garbage” or blanks allowed for pay rate or hours worked

RESTRICTIONS
1. You may not use global variables
2. You may not use GOTO statements
3. You may NOT use code from the Web
4. no infinite loops
4 (a). while(true)
4 (b). for(;;)
5. no break statement to exit loops


IMPORTANT NOTE: You must use prototype functions below to develop your program. Your task it to write the main() function as well as the definitions for the function prototypes.

BELOW FUNCTIONS CANNOT BE EDITED PER ASSIGNMENT REQUIREMENTS

================================================================

#include
#include
#include
using namespace std;

// Constant for the array size.
const int EMPLOYEE_SIZE = 7;

// Functions
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;
}

===============================================================

BELOW ARE SCREEN SHOTS FROM WORING PROGRAMM

Enter the requested information for each employee Employee 1 Hours worked:

Solution

Below is the code which will work as per you expectation.:-

#include<iostream>
#include<string>
using namespace std;


int main(void)
{
   //declare the arrays
   const int EMPLOYEESIZE = 7;
   int empID[7] = { 1, 2, 3, 4, 5, 6, 7 };
   int hours[7];
   double payRate[7];
   double wages[7];
   int i;

   //Display each employees number and ask the user to enter that employees hours and pay rate
   for (i = 0; i < EMPLOYEESIZE; i++)
   {
       cout << \"Enter employee \" << empID[i] << \"\' s hours\" << endl;
       cin >> hours[i];
       cout << \"Pay rate?\";
       cin >> payRate[i];
   }

   //It should then calculate the gross wages for that employee(hours*payRate) which should be stored in the wages array
   for (i = 0; i < EMPLOYEESIZE; i++)
   {
   if ((payRate[i]>=5 && payRate[i]<=40)&&(hours[i]>0 && hours[i]<=40)){
       wages[i] = (hours[i] * payRate[i]);
  
   }
   else if(payRate[i]<5 || payRate[i]>40){
       cout << \"Pay Rate must be greater than or equal to $5 but less than or equal to $15\";
   }
   else{
       cout << \"Hours worked must be greater than 0 but less than or equal to 40\";
   }
   }


   //After the data has been entered for all employees, the program should display each employees ID number and gross wages.
   for (i = 0; i < EMPLOYEESIZE; i++)
   {
       cout << \"The gross wages for employee \" << empID[i] << \" is $\" << wages[i] << endl;
   }

   return 0;
}

Hello, I need help with C++ program that calculates hourly wage of 7 employees using parrallel arrays 1. empID: An array of 7 integers to hold employee identifi
Hello, I need help with C++ program that calculates hourly wage of 7 employees using parrallel arrays 1. empID: An array of 7 integers to hold employee identifi
Hello, I need help with C++ program that calculates hourly wage of 7 employees using parrallel arrays 1. empID: An array of 7 integers to hold employee identifi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site