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

Can you please do the c++ project make sure it works Using the technique similar

ID: 3697205 • Letter: C

Question

Can you please do the c++ project make sure it works

Using the technique similar to the one outlined in Fig. 14.3 of your textbook, create a payroll input file that contains five employee "records". Each record should contain three fields: Employee ID (numbers only) Number of hours worked (floating point field) Pay rate (floating point field) Then: Read the input file created above, and calculate each employee's gross pay by multiplying the hours worked by the pay rate. Create an output file that contains one record for each employee. Each record should contain four fields: Employee ID Number of hours worked Pay rate Gross pay The amount fields should be rounded to 2 decimal places. The fields in the output file should be separated by commas. Also write each output record to the screen. The screen output should have appropriate titles, and the employee information should be formatted so as to be lined up under the appropriate titles. The screen output amount fields should be formatted with currency signs.

Explanation / Answer

Hi ,Implemented code as your requirement specification..

CODE:

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>

int EmpID; //Employee Identity.
int hours; //Number of Working Hours
double pay; //pay rate per hour
double grosssalary; //Gross salary
using namespace std;

int main()
{

   ifstream oldtxtfile;
   oldtxtfile.open ("employeeipt.txt", ios::in);

   ofstream newtxtfile;
   newtxtfile.open ("Salaryopt.txt");

   if(!oldtxtfile)
   {
   cerr << "File could not be opened, Make sure you put it in the same directory as this .CPP file!" << endl;
exit( 1 );
   }

       for (int l = 0 ; l< 3 ; l++)
       {
          
           oldtxtfile >> EmpID;
           oldtxtfile >> setw(2);

           newtxtfile << EmpID;
           newtxtfile << setw(2);
  
           oldtxtfile >> hours;
           oldtxtfile >> setw(2);
           oldtxtfile >> pay;
           grosssalary = hours * pay;
           oldtxtfile >> endl;

           newtxtfile << grosssalary;
           newtxtfile << endl;

       }
      

           oldtxtfile.close();
           newtxtfile.close();

  

   return 0 ;
}