Question: Hi, Please see my code below I managed to get this far but not sure why am I not getting the right file created. I

Hi,

Please see my code below I managed to get this far but not sure why am I not getting the right file created. I created a .txt file and when I actually find the output thisWeekGrossPay.txt file it shows 000000 . basically the question is to create a file under myEmployee.txt that would show this;

Daniel Consuegra 9.50 40 Kamal Salomon 15 43 Patricia Gonzalez 13 41 Antonio Suarez 11 48 Valerie Diaz 23 45

I run program it comes 0 code error, the idea is that the output shows names and weekly gross pay in output. Please help.

#include

#include

#include

#include

using namespace std;

int main()

{

ifstream inFile;

ofstream outFile;

double payRate, hoursWorked;

double grossPay;

string firstName;

string lastName;

inFile.open("myEmployee.txt");

outFile.open("thisWeekGrossPay.txt");

cout<

//First Employee

inFile>>lastName>>firstName>>payRate>>hoursWorked;

grossPay = payRate * hoursWorked;

outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl;

//Second Employee

inFile>>lastName>>firstName>>payRate>>hoursWorked;

grossPay = payRate * hoursWorked;

outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl;

//Third Employee

inFile>>lastName>>firstName>>payRate>>hoursWorked;

grossPay = payRate * hoursWorked;

outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl;

//Fourth Employee

inFile>>lastName>>firstName>>payRate>>hoursWorked;

grossPay = payRate * hoursWorked;

outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl;

//Fifth Employee

inFile>>lastName>>firstName>>payRate>>hoursWorked;

grossPay = payRate * hoursWorked;

outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl;

inFile.close();

outFile.close();

system("PAUSE");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!