Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago