People go to the beach and often buy a bunch of stuff that will only be used at the beach. Pretend you own a beach-side emporium that sells the usual stuff: inflatable toys, suntan lotion, shark-tooth necklaces, flip flops, and the like. You made 26 sales today, and you have captured that sales data in a comma separated text file that lists the day's sales. Here are the first several lines, alita,frisbee,11.5,3 betty,shark-tooth necklace,9.25,4 carlos,squirt gun,9.75,5 diego,flip flops,7.77,1 elena,snorkle,9.5,2 Shown below is the data separated out so it is easy to read. But the file itself is comma separated, like the above. The file contains no column names, but if it did the columns would be named Customer Name, Item, Price, Quantity. For example, alita bought 3 frisbees at $11.50 each. alita frisbee 11.5 3 betty shark-tooth necklace 9.25 4 carlos squirt gun 9.75 5 diego flip flops 7.77 1 elena snorkle 9.5 2 frank umbrella 32.2 3 Shown above is only part of the data file. As we said, the file itself has 26 rows of 4 data items per row. 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 can be accessed using this link:   makewaves.txt.   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. Name Item Price Quantity Total alita frisbee 11.50 3 34.50 betty shark-tooth necklace 9.25 4 37.00 Carlos squirt gun 9.75 5 48.75 dieg0 flip flops 7.77 1 7.77 elena snorkel 9.50 2 19.00 ... and 21 more rows... ... 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 today. 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 the exercise.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

People go to the beach and often buy a bunch of stuff that will only be used at the beach. Pretend you own a beach-side emporium that sells the usual stuff: inflatable toys, suntan lotion, shark-tooth necklaces, flip flops, and the like. You made 26 sales today, and you have captured that sales data in a comma separated text file that lists the day's sales. Here are the first several lines,

alita,frisbee,11.5,3
betty,shark-tooth necklace,9.25,4
carlos,squirt gun,9.75,5
diego,flip flops,7.77,1
elena,snorkle,9.5,2

Shown below is the data separated out so it is easy to read. But the file itself is comma separated, like the above. The file contains no column names, but if it did the columns would be named Customer Name, Item, Price, Quantity. For example, alita bought 3 frisbees at $11.50 each.

alita frisbee 11.5 3
betty shark-tooth necklace 9.25 4
carlos squirt gun 9.75 5
diego flip flops 7.77 1
elena snorkle 9.5 2
frank umbrella 32.2 3

Shown above is only part of the data file. As we said, the file itself has 26 rows of 4 data items per row.

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 can be accessed using this link:   makewaves.txt.  

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.

Name Item Price Quantity Total alita frisbee 11.50 3 34.50 betty shark-tooth necklace 9.25 4 37.00 Carlos squirt gun 9.75 5 48.75 dieg0 flip flops 7.77 1 7.77 elena snorkel 9.50 2 19.00 ... and 21 more rows... ... 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 today. 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 the exercise.
Expert Solution
Step 1

the answer is given below:-

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY