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 or 2d 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 SCREENSHOTS OF THE PROGRAM:

Enter the requested information for each employee Employee 1 Hours worked

Solution

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

   // Constant for the array size.
const int EMPLOYEE_SIZE = 7;
// Functions
void validateHoursWorked(string str1, int& userNumber)
{
   if (userNumber < 0 || userNumber >40)
   cout<<str1;
  
}
void validatePayRate(string str1, double& userNumber)
{
   if (userNumber < 5 || userNumber >15)
   cout<<str1;
  
}
void getEmployeeInfo(int empId[], int hours[], double payRate[], double wages[], int EMPLOYEE_SIZE)
{
   cout<<\"\ Enter the requested information for each employee\";
   for(int i=0;i<EMPLOYEE_SIZE;i++)
   {
       cout<<\"\ Employee #\"<<empId[i];
       cout<<\"\ \\tHours Worked: \";
       cin>>hours[i];
       validateHoursWorked(\"hours worked must be greater than 0 but less than or equal to 40\",hours[i]);
       cout<<\"\ \\tPay Rate: \";
       cin>>payRate[i];
       validatePayRate(\"Pay Rate must be Greater Than $5 but less than $15\",payRate[i]);
       wages[i] = hours[i] * payRate[i];
   }
  
}
void displayWages(int empId[], double wages[], int EMPLOYEE_SIZE)
{
   cout<<\"\ ------------------------------------------\";
   cout<<\"\ Employee\\t\\t\\tWages\";
   for(int i=0;i<EMPLOYEE_SIZE;i++)
   {
       cout<<\"\ Employee #\"<<empId[i]<<\"\\t\\t\\t\" <<wages[i];
      
   }
  
}

int main()
{

// declare Array of employee ID numbers
  
int empId[EMPLOYEE_SIZE] = {1,2,3,4,5,6,7};   
// declare Array to hold the hours worked for each employee
int hours[EMPLOYEE_SIZE];

// declare Array to hold the hourly pay rate for each employee
  
double payRate[EMPLOYEE_SIZE];
// declare Array to hold the gross wages for each employee
double wages[EMPLOYEE_SIZE];
// Get the employee payroll information and store it in the arrays.
getEmployeeInfo(empId, hours, payRate, wages, EMPLOYEE_SIZE);
// call the function getEmployeeInfo
  

// Display the payroll information.

// call the function displayWages
displayWages(empId,wages,EMPLOYEE_SIZE);


system(\"pause\");
return 0;
}

output

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site