Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DO PART 2 ONLY! USE CODE FROM PART 1 AS REFERENCE. CODE FROM PART 1 IS DOWN BELOW! #include #include #include using namespace std; #include
DO PART 2 ONLY! USE CODE FROM PART 1 AS REFERENCE. CODE FROM PART 1 IS DOWN BELOW!
#include
#include
#include
using namespace std;
#include
int main() {
ofstream file("data.txt");
string name;
int id, years;
char s;
double wage;
cout
file
for (int i = 1; i
{
cout
cin >> id;
cin.ignore(256, ' ');
cout
getline(cin, name);
cout
cin >> s;
cout
cin >> wage;
cout
cin >> years;
file
}
}
You are expected to use Loops and 10 filestreams in this program. Write comments to explain what each statement does, and how it achieves the desired results (Review the rubric posted under Course Materials to understand how your program will be graded) PART 1: Write a program in C++ that permits users to enter the following information about your company's five employees and writes the following information to the file (data.txt). ID no. Name Sex (M/E) Hourly Wages Years with company All information must be displayed in a well formatted manner, so you can put in relevant manipulators for this purpose. Run your program, put in employee information (for 5 employees), and verify if you have a txt file as required. PART 2: At this point you must have a .txt file with information of 5 employees. Go back to your C++ program (from part 1), put the entire existing program from part 1 within block comments. Now write a new program for part 2 (in that same C++ file) as per instructions given below. Write a C++ program that reads this file data.txt, one line at a time, asks for the number of hours worked by each employee and calculates their total pay for the month. So for each of the employee records that stream in, your program must ask user: Enter hours worked by (name of employee): When user puts in the answer, program must calculate the total salary and display on the computer screen as 'The salary of (name) is $ (salary). EXTRA CREDIT (10 points) Make provisions in your part 2 program for the salary information (along with some other employee details) to be stored in a new file called (February_salary.txt). Your information must be saved to the file in the following format. ID no. Name Hourly wages SalaryStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started