Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8. Three employees in a company are up for a special pay increase. You are given

ID: 3620242 • Letter: 8

Question

8. Three employees in a company are up for a special pay increase. You are given a file, Ch3_Ex8Data.txt, with the following data

Miller Andrew 65789.87 5
Green Sheila 75892.56 6
Sethi Amit 74900.50 6.1

Each input line consists of the employee's last name, first name, current salary, and precent pay increase. Write a program that reads data from the specified file and stores the output in the file Ch3_Ex8Output.dat. For each employee the days must be output in the following form: firstName, lastName, updatedSalary. Format the ouput of the decimal numbers to two decimal places.

Explanation / Answer

please rate - thanks #include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{string first,last;
double salary,rate,updated;
ifstream in;
ofstream out;
in.open("Ch3_Ex8Data.txt");           //open file
if(in.fail())             //is it ok?
{ cout<<"file did not open please check for it's existance program aborting ";
   system("pause");
   return 1;
    }
out.open("Ch3_Ex8Output.dat");
out<<" Updated ";
out<<" First Last Salary ";
out<<"------------------------------------ ";    
in>>first;
while(in)
{in>>last>>salary>>rate;     
updated=salary+(salary*(rate/100.));
out<<first<<" "<<last<<" $"<<setprecision(2)<<fixed<<updated<<endl;
in>>first;
}
in.close();
out.close();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote