Help with homework


Write a program to process weekly employee time cards for all employees of an organization. Each employee will have three data items: the employee's name, the hourly wage rate, and the number of hours worked during a given week. Each employee is to be paid time and a half for all hours worked over 40. A tax amount of 3.625 percent of gross salary will be deducted. The program output should show the employee’s name, gross pay,and net pay, and should also display the total net and gross amount and their averages.Use zzzzzz as a sentinel value for name

this what i have so far

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
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
	string name;
	float wage, grosspay, netpay;
	float totalnet, totalgross, average; 
	int hours,overhours,overtimewage;
	string zzzzzz;

	cout << "\nTo stop enter zzzzzz";

	while ( name!="zzzzzz")
	{	
		cout << "\nPlease enter employee's last name:";
		cin >> name;
		cout << "\nPlease enter hours per week:";
		cin >> hours;
		cout << "\nPlease enter hourly wage rate:";
		cin >> wage;
		
		if (hours<40)
		
		{
			grosspay= hours*wage;
		}
		if  (hours>40)
		{
			overhours= hours-40;  
			grosspay=(0.5*overhours)+overhours+40;
		}	
	
		netpay=grosspay-(3.625/100)*grosspay;   //netPay calculation
		
	
		cout << "\nEmployee:"<< name;
		cout << "\nGross Pay:"<< grosspay<< endl<<endl;
		cout << "\nNet Pay:"<< netpay;
			
	}

return 0;
}
in the overtime calculation,there is logical mistake

it should be
1
2
3
OT_pay=0.5*overhours*wage;
reg_pay=(hours-overhour)*wage;
grosspay=OT_pay+reg_pay;



your code didnt used the wage for calcualtions
When user enters hours worked =40, the program shows error. so please correct it
Topic archived. No new replies allowed.