This certain program is needed to calculate how many employees you entered and get their hours to figure out their salaries. The main function for basically getting the number of employees and hourly pay for each one, then take that information into another function to get the number of hours so the program can figure out how much money he gets, including his overtime, then in another function is which a list is printed out for each employee, and another function for the grand total of all their pay. But as you'll see from the program, i had trouble on where each parameter goes for each function, which I'm kinda of stuck on. I also would like it if you could correct some of my in corrections in this program, which would be greatly appreciated with a explanation, then I could better understand it.
// Homework.cpp : Defines the entry point for the console application.
//
#include <iostream>
usingnamespace std;
double payfunction(double &, int);
// Get number of employees and hourly salarys
int main()
{
int num_employees = 0;
int hourly_salary = 0;
double employee_total = 0;
double total_allemployees = 0;
cout << "How many employees are there (enter a number below 10)?\n";
cin >> num_employees;
for(int i=0; i < num_employees; i++)
{
cout << "What is the hourly salary for employee " << i << ": ";
cin >> hourly_salary;
}
payfunction(num_employees, hourly_salary);
printpay()
printpay()
system("pause");
return 0;
}
// Print pay function: get number of hours for each employee
// if under 40s, hours * payrate, if over 40, hours(payrate * 1.5)
double payfunction(int num_employees, hourly_salary)
{
int num_hours
double employee_total
for (int i=0; i < num_employees; i++)
{
cout << "How many hours did employee: " << i <<" " <<endl;
cin >> num_hours;
if (num_hours < 40)
{
employee_total = num_hours * hourly_salary;
}
else
{
employee_total = num_hours * (hourly_salary * 1.5);
}
}
return employee_total;
}
// PrintPay: Take number of employees and results from print pay function
// and prints them out in this function, Not a void function.
int printpay(
{
for(int i=0; i < num_employees; i++)
{
for(int j=0; j < num_hours; i++)
{
}
cout << "Employee number: " << i+1 << "made $" << employeetotal << endl;
}
}
// PrintPay: Make the total of all the money made into one total
void printpay(
{
cout << "The total amount to money all the employees made at once is" << total_allemployees << endl;
}