Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download the files.cpp program and the payroll.dat file. Follow the instructions described in the comments of file.cpp to successfully print out the data requested. Make

Download the files.cpp program and the payroll.dat file. Follow the instructions described in the comments of file.cpp to successfully print out the data requested. Make sure that user output is easy to read and grammatically correct.
Starting Code: files.cpp Download files.cpp, payroll.datp
Change the data in the payroll.dat file and test the program again. Verify your outputs using a calculator to ensure that your program is performing the calculations correctly. Make adjustments as necessary.
files.cpp =
// This program uses hours, pay rate, state tax and fed tax to determine gross
// and net pay.
#include
#include
#include
using namespace std;
int main()
{
// Fill in the code to define payfile as an input file
float gross;
float net;
float hours;
float payRate;
float stateTax;
float fedTax;
cout << fixed << setprecision(2)<< showpoint;
// Fill in the code to open payfile and attach it to the physical file
// named payroll.dat
// Fill in code to write a conditional statement to check if payfile
// does not exist.
{
cout << "Error opening file.
";
cout <<"It may not exist where indicated" << endl;
return 1;
}
cout << "Payrate Hours Gross Pay Net Pay"
<< endl << endl;
// Fill in code to prime the read for the payfile file.
// Fill in code to write a loop condition to run while payfile has more
// data to process.
{
payfile >> payRate >> stateTax >> fedTax;
gross = payRate * hours;
net = gross -(gross * stateTax)-(gross * fedTax);
cout << payRate << setw(15)<< hours << setw(12)<< gross
<< setw(12)<< net << endl;
payfile >>// Fill in the code to finish this with the appropriate
// variable to be input
}
payfile.close();
return 0;
}
payroll.dat =
12
0.06
0.12

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

b. Did you suppress any of your anger? Explain.

Answered: 1 week ago