Help with payroll program almost have it

Hello everyone I almost have my program working. (I think)
Here's what it requires it to do.

Write a program that displays a weekly payroll report. A loop in the
program should ask the user to enter the following data.

- Employee number
- Number of hours worked
- Hourly pay rate
- Percentage to be withheld for state income tax
- Percentage to be withheld for federal income tax
- Percentage to be withheld for FICA

The loop will terminate when 0 is entered for the employee number. The program
should calculate and display the following data for each

- Employee number
- Gross pay (the number of hours worked multiplied by the hourly pay rate)
- State income tax with holdings(gross pay multiplied by state income tax percentage)
- Federal income tax with holdings (gross pay multiplied by federal income tax
percentage)
- Federal Insurance Contributions Act (FICA) with holdings (gross pay multiplied by FICA percentage)
- Net pay (the gross pay minus state income tax,federal income tax, and FICA)

I am having trouble getting it to loop when information is entered correctly.
When I enter a negative number then re-enter the info it loops.
Also I cant get the employee number 0 to exit the program.

HERE IS MY CODE and thank you everyone

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
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	
	int employeeNum; //employee number
	int hoursWorked; // hours worked
	float hourlyPay, gross, statetax, federaltax, fica; //gross income,state tax, federal tax, fica
	double spay, fpay, ficapay, netpay; //state federal and fica withholdings including netpay

	// Loop to do everything
	do
	{
		// Prompt
		cout << "Enter the employee number: ";
		cin  >> employeeNum;

		cout << "Enter hours worked: ";
		cin  >> hoursWorked;

		cout << "Enter hourly pay rate: ";
		cin  >> hourlyPay;

		cout << "Enter percentage to be withheld for state income tax in decimal form: ";
		cin  >> statetax;

		cout << "Enter percentage to be withheld for federal income tax in decimal form: ";
		cin  >> federaltax;

		cout << "Enter percentage to be withheld for FICA in decimal form: ";
		cin  >> fica;
		
		gross = hoursWorked * hourlyPay;        //Grosspay
		spay = gross * statetax;                //State income tax withholdings
		fpay = gross * federaltax;              //Federal income tax withholdings
		ficapay = gross * fica;                 //FICA withholdings
		netpay = gross - spay - fpay - ficapay; //Netpay

		
		// What hapens went a negative number is entered
		while (hoursWorked < 0 || hourlyPay < 0 || statetax < 0 || federaltax <  0 || fica < 0)
		{

		// Makes user re-enter data because user entered a number less than 0
		cout << " " << endl;
		cout << "Re-enter data must be greater than 0: " << endl; 

		cout << "Enter the employee number: ";
		cin >> employeeNum;

		cout << "Enter hours worked: ";
		cin >> hoursWorked;

		cout << "Enter hourly pay rate: ";
		cin >> hourlyPay;

		cout << "Enter percentage to be withheld for state income tax: ";
		cin >> statetax;

		cout << "Enter percentage to be withheld for federal income tax: ";
		cin >> federaltax;

		cout << "Enter percentage to be withheld for FICA: ";
		cin >> fica;
		
		gross = hoursWorked * hourlyPay;        //Grosspay
		spay = gross * statetax;                //State income tax withholdings
		fpay = gross * federaltax;              //Federal income tax withholdings
		ficapay = gross * fica;                 //FICA withholdings
		netpay = gross - spay - fpay - ficapay; //Netpay
		}

		cout << "Payroll Report:\n\n";
		cout << "The Employee Number is: " << employeeNum << endl;
		cout << "You gross pay is: $" << gross << endl;
		cout << "Your state tax withheld is: $" << spay << endl;
		cout << "Your federal tax withheld is: $" << fpay << endl;
		cout << "Your FICA withholdings is: $" << ficapay << endl;
		cout << "Your total netpay is: $" << netpay << endl;
		
		
	}while(employeeNum == 0);
	return 0;
	}

Your "re-enter data" loop works for me.
As for main loop, your condition
(employeeNum == 0)
implies, that you want to enter another data if employeeNum equale 0. You probably want (employeeNum != 0)
Topic archived. No new replies allowed.