Different functions for a salary program, problems.

closed account (172v0pDG)
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Homework.cpp : Defines the entry point for the console application.
//

#include <iostream>
using namespace 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;
}
Topic archived. No new replies allowed.