// Lab 4 read and calculation file/input
// This program will read the data in the input file
// used by grosspayMinustaxFileCode
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
// this is the error message it displays if not working right to EXIT
{
ifstream inFile;
ofstream outFile;
int employee = 1;// I am trying to get loop initialized
int exemptions, taxbracket; //the read other file cue
double hours, overtime, payrate, grosspay, netpay, rate, tax;
inFile.open("readGrosspayMinustax.cpp");
if (inFile.fail())
{
cerr << "error opening input file.\n\n";
system("pause");
exit(1);
}
outFile.open("outputGrosspay");
if (outFile.fail())
{
cerr << "error opening input file.\n\n";
system("pause");
exit(1);
}
outFile.setf(ios::fixed);
inFile >> employee;
inFile >> hours;
inFile >> payrate;
inFile >> taxbracket;
inFile >> exemptions;
while (cin >> hours)
{
if (hours > 40)
{
overtime = hours - 40;
hours = 40;
}
else
overtime = 0;
grosspay = hours * payrate + overtime * payrate * 1.5;
if (taxbracket == 1)
rate = .13;
else if (taxbracket == 2)
rate = .27;
else
rate = .35;
tax = grosspay * (rate - .01 * exemptions);
netpay = grosspay - tax;
cout << fixed << showpoint << setprecision(2)<< endl;
cout << employee << hours << payrate << taxbracket << exemptions << endl;
cout << grosspay << tax << netpay;
inFile >> employee;
inFile >> payrate;
inFile >> taxbracket;
inFile >> exemptions;
}
inFile.close();
system("pause");
return 0;
}
\\ This is the read file where the fin.in file will derived data.
50.00 20.00 2 3
40.00 10.00 1 0
10.00 40.00 3 5
40.00 11.25 1 2
not getting any output right above this statement