Access over 20 million homework & study documents
search

3A) Expand your Payroll Program so that it interactively repeats for

Content type

User Generated

Rating

Showing Page:
1/6
3A) Expand your Payroll Program so that it interactively
repeats for as many employees as the user specifies:
Example:
How many employees would you like to enter? 5
Enter Employee Id 6740
Enter Hours Worked 40
Enter Hourly Rate $10
Employee Id is 6740
The Hours Worked are 40
The Hourly Rate is $10
The Gross Pay is $400
The Tax Amount is $120
The Net Pay is $280
Enter Employee Id 3578
Enter Hours Worked 30
Enter Hourly Rate 10
...
...
3B) Expand your Payroll program so that it repeats for as
many employees are in the input file.
Data typed and saved under employee.in
Use:
#include
#include
using namespace std;
…….
ifstream fin(\"employee.in\");
………
while(fin>>employeeid>>hoursworked>>hourlyrate){.
..}//end loop
-----
Not really sure how to go about doing this.. this is what I
have so far by the way:
#include

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/6
using namespace std;
main() {
int employeeid;
int hoursworked;
float hourlyrate, grosspay, taxamount, netpay;
float const TAXRATE = 0.10;
cout << \"ENTER THE EMPLOYEE ID: \";
cin >> employeeid;
cout << \"ENTER THE HOURS WORKED: \";
cin >> hoursworked;
cout << \"ENTER THE HOURLY RATE: \";
cin >> hourlyrate;
grosspay = hoursworked * hourlyrate;
taxamount = grosspay * TAXRATE;
netpay = grosspay - taxamount;
cout << \"EMPLOYEE ID IS \" << employeeid << endl;
cout << \"THE HOURS WORKED ARE \" << hoursworked
<< endl;
cout << \"THE HOURLY RATE IS \" << hourlyrate << endl;
cout << \"THE GROSSPAY IS \" << grosspay << endl;
cout << \"THE TAXAMOUNT IS \" << taxamount << endl;
cout << \"THE TAXRATE IS \" << TAXRATE << endl;
cout << \"THE NETPAY IS \" << netpay << endl;
return 0;
}//MAIN
Solution
Q3A)
#include<iostream>

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/6

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 6 pages?
Access Now

Unformatted Attachment Preview

3A) Expand your Payroll Program so that it interactively repeats for as many employees as the user specifies: Example: How many employees would you like to enter? 5 Enter Employee Id 6740 Enter Hours Worked 40 Enter Hourly Rate $10 Employee Id is 6740 The Hours Worked are 40 The Hourly Rate is $10 The Gross Pay is $400 The Tax Amount is $120 The Net Pay is $280 Enter Employee Id 3578 Enter Hours Worked 30 Enter Hourly Rate 10 ………….………….. ………….………….. 3B) Expand your Payroll program so that it repeat s for as many employees are in the input file. Data typed and saved under employee.in Use: #include #include using namespace std; ……. ifstream fin(\"employee.in\"); ……… while(fin>>employeeid>>hoursworked>>hourlyrate){…….… ..}//end loop ----Not really sure how to go about doing this.. this is what I have so far by the way: #include using namespace std; main() { int employeeid; int hoursworked; float hourlyrate, grosspay, taxamount, netpay; float const TAXRATE = 0.10; cout > employeeid; cout > hoursworked; cout > hourlyrate; grosspay = hoursworked * hourlyrate; taxamount = grosspay * TAXRATE; netpay = grosspay - taxamount; cout ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great content here. Definitely a returning customer.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4