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 snorkels at $ each, so her order
total would be $ 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 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 commaseparated 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 data rows must not be altered in any way.
Here is and approximation of what your printout should look like using the first
rows as an example. Your output should look similar, with all currency values
rounded to decimal places, but yours will have all records and at the end a
display of the sales total for the whole day grand total the 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 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 pieces of information in all 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 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 as a magic number. The program should
work no matter how many records the file might contain.
Your program must have at least functions written by you. The first one
is a main function which reads the data file. You could easily have more
than functions if you choose, but you need 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 argumentsreturn values is a goal of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
