I am writing a code that is supposed to give the payroll info for a specified number of employees. The user is first asked to enter the employee’s name, hourly wages, and number of hours worked for the week. Then when that is done the employee’s data, which consist of the employee’s name, their gross ( wages * hours), and their Net (gross after a 3.36% tax rate), has to be shown. Then the code has to loop to where different info can be enter for another employee until the string variable is entered to stop the loop. When the specified number of employees is met then an overall payroll summary must be made which consist of the number of employees, total gross, average gross, total Net, average Net. My first problem is getting the Net. My second problem is I’m not sure if my code is clean enough or edited properly so I would really appreciate it if someone could help me out. (refer to the uploaded file for a better understanding of the assignment.

This is what I have so far:

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

int main ()

// Get first employee
cout << "Enter employee name (\'asdfg\' to quit): ";	// line of code asking for the user to input the Employee's name
getline(cin, empName, '\n');
while( empName != "asdfg" )		// "asdfg" is the input to stop the code from looping
	int hours;			// number of hours employee has worked
	float wages;		// wages per an hour
	cout << "Enter hours worked for week: ";
	cin >> hours;
	cout << "Enter hourly wage: ";
	cin >> wage;

Edited 5 Years Ago by Narue: Added code tags

When programming, you need to write the program (it's writing a program, not writing a code) in stages.

Finish what you have and output the data entered at the end.
Compile. Fix compiler errors. Repeat.

When the program runs correctly (that means outputs the data entered correctly) then add the next step in the program. In your case, calculate the GROSS pay.

Be sure to properly format your code (this info will help) and post with CODE tags (explained all over the site, you can't help but find them)

This article has been dead for over six months. Start a new discussion instead.