Question: Your program should read the file and print each row along with the total for each order. For example, elena bought 2 snorkels at $

Your program should read the file and print each row along with the total for
each order. For example, elena bought 2 snorkels at $9.50 each, so her order
total would be $19.00. We will assume there is no sales tax.
Additionally, after printing the row data, your program should print grand total
for the day (the sum of all the 26 individual totals) To repeat, for each record
your program should print the name, item purchased, price, quantity
purchased, and the order total for that customer. After printing all the file data
with calculations, you need to print the total sales for the day.
The comma-separated text file you need to use is named makewaves.txt and
is available on the course website.
Clicking the link probably opens the file in your browser. Save the file
somewhere you can find it. But the name of the file must be makewaves.txt,
and the 26 data rows must not be altered in any way.
Here is and approximation of what your print-out should look like using the first
5 rows as an example. Your output should look similar, with all currency values
rounded to 2 decimal places, but yours will have all 26 records and at the end a
display of the sales total for the whole day (grand total the 26 individual totals).
Your output should look similar; it need not be exact. But everything must line
up neatly, including the decimal places. It's time we get good at formatting
output.
... and 21 more rows...
dots and then print the total sales for the day
To get full credit your program needs to accomplish the following.
Your code needs to read the makewaves.txt data from the supplied text
file. Do not modify the file, and it needs to keep its current name and
structure. I will use my copy of the file to test your program. So, the file
opened must be named makewaves.txt and it must contain the same
records used in the link above.
You need to print the 4 pieces of information in all 26 rows along with a
total for that person's purchase. Printouts need to be neat and properly
aligned, where the names and items are left justified and decimals line up
for currency values. If you format the currencies to 2 decimal places,
which is a requirement, this will be easier to do.
You need to process the data with a loop, and that loop should be able to
work properly even if the number of purchases in the file varies from day
to day. That is, don't use 26 as a magic number. The program should
work no matter how many records the file might contain.
Your program must have at least 2 functions written by you. The first one
is a main(') function which reads the data file. You could easily have more
than 2 functions if you choose, but you need 2 minimum, one of which is
named main() that reads the data.
The second function must calculate the total for each customer, receiving
as parameters the price and quantity for each customer when called from
the main loop. Knowing how to do arguments/return values is a goal of
 Your program should read the file and print each row along

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!