Suppose that the file inData.txt, data set 1, contains the following data: Giselle Robinson Accounting 5600 5 30 450 9 75 1.5 The first line contains a person’s first name, last name, and the department the person works in. In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent). The third line contains the distance traveled and the traveling time. The fourth line contains the number of coffee cups sold and the cost of each coffee cup. Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results. Name: Giselle Robinson, Department: Accounting Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxes: 30.00% Paycheck: $4116.00 Distance Traveled: 450.00 miles, Traveling Time: 9.00 hours Average Speed: 50.00 miles per hour Number of Coffee Cups Sold: 75, Cost: $1.50 per cup Sales Amount = $112.50 Programming code devc++ and mindtap

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 7E: (File creation) Write a C++ program that creates an array containing the integer numbers 60, 40, 80,...
icon
Related questions
Question

Suppose that the file inData.txt, data set 1, contains the following data:

Giselle Robinson Accounting

5600 5 30

450 9

75 1.5

The first line contains a person’s first name, last name, and the department the person works in.

In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent).

The third line contains the distance traveled and the traveling time.

The fourth line contains the number of coffee cups sold and the cost of each coffee cup.

Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results.

Name: Giselle Robinson, Department: Accounting

 

Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxes: 30.00%

Paycheck: $4116.00

 

Distance Traveled: 450.00 miles, Traveling Time: 9.00 hours

Average Speed: 50.00 miles per hour

 

Number of Coffee Cups Sold: 75, Cost: $1.50 per cup Sales Amount = $112.50

 

Programming code devc++ and mindtap

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main() {
// Write your main here
ifstream inFile;
ofstream outFile;
inFile.open("inData.txt");
outFile.open("outData.txt");
inFile.close();
out File.close();
return 0;
Transcribed Image Text:#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; int main() { // Write your main here ifstream inFile; ofstream outFile; inFile.open("inData.txt"); outFile.open("outData.txt"); inFile.close(); out File.close(); return 0;
8:15 a d oR
ll 25%
ng.cengage.com/static
* CENGAGE MINDTAP
Q Search this course
Programming Exercise 3-1
O Store Input Data in Formatted File
+ >- Tern +
inData...
main.c...
1 #include
<iostream>
Instructions
2 #include <fstream>
A-Z
3 #include <string>
4 #include <iomanip>
Suppose that the file inData.txt, data set 1, contains the
</>
following data:
6 using namespace
目
std;
7
Giselle Robinson Accounting
8 int main() {
// Write your
5600 5 30
450 9
main here
75 1.5
10
ifstream
inFile;
11
ofstream
The first line contains a person's first name, last name, and
outFile;
12
13
("inData.txt");
outFile.open
the department the person works in.
inFile.open
In the second line, the first number represents the monthly
14
gross salary, the bonus (as a percent), and the taxes (as a
("outData.txt");
percent).
15
16
The third line contains the distance traveled and the traveling
17
18
time.
inFile.close();
19
The fourth line contains the number of coffee cups sold and
out File.close();
20
21
22
the cost of each coffee cup.
Write statements so that after the program executes, the
return
0;
contents of the file outData.txt are as shown below. If
23 }
necessary, declare additional variables. Your statements
24
should be general enough so that if the content of the input
file changes and the program is run again (without editing and
recompiling), it outputs the appropriate results.
Name: Giselle Robinson, Department: Accounting
Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxe:
Paycheck: $4116.00
Distance Traveled: 450.00 miles, Traveling Time: 9.00 hour:
Average Speed: 50.00 miles per hour
Number of Coffee Cups Sold: 75, Cost: $1.50 per cup
Sales Amount = $112.50
4/6
!!
Transcribed Image Text:8:15 a d oR ll 25% ng.cengage.com/static * CENGAGE MINDTAP Q Search this course Programming Exercise 3-1 O Store Input Data in Formatted File + >- Tern + inData... main.c... 1 #include <iostream> Instructions 2 #include <fstream> A-Z 3 #include <string> 4 #include <iomanip> Suppose that the file inData.txt, data set 1, contains the </> following data: 6 using namespace 目 std; 7 Giselle Robinson Accounting 8 int main() { // Write your 5600 5 30 450 9 main here 75 1.5 10 ifstream inFile; 11 ofstream The first line contains a person's first name, last name, and outFile; 12 13 ("inData.txt"); outFile.open the department the person works in. inFile.open In the second line, the first number represents the monthly 14 gross salary, the bonus (as a percent), and the taxes (as a ("outData.txt"); percent). 15 16 The third line contains the distance traveled and the traveling 17 18 time. inFile.close(); 19 The fourth line contains the number of coffee cups sold and out File.close(); 20 21 22 the cost of each coffee cup. Write statements so that after the program executes, the return 0; contents of the file outData.txt are as shown below. If 23 } necessary, declare additional variables. Your statements 24 should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results. Name: Giselle Robinson, Department: Accounting Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxe: Paycheck: $4116.00 Distance Traveled: 450.00 miles, Traveling Time: 9.00 hour: Average Speed: 50.00 miles per hour Number of Coffee Cups Sold: 75, Cost: $1.50 per cup Sales Amount = $112.50 4/6 !!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr