Question
A text file GroceryData . txt contains grocery shopper names and the amount they spent on their groceries for each trip to the grocery store
A text file "GroceryData.txt" contains grocery shopper names and the amount they spent on their groceries for each trip to the grocery store this month. For example: the first line contains "Carol,35.00,67.00,13.00". Which means Carol went to the grocery store 3 times this month and spent $35, $67, and $13. Calculate the average grocery bill for each shopper for the month. Keep in mind that some shoppers have more visits than others so make sure your code uses every trip for each shopper in its calculations. Print the results out to the screen in the following format with each shopper on a new line: "Name: Carol, Average: 38.33333"
Data in text file should be:
Carol, 35.00,67.00,13.00
Steve, 14.00,82.00,41.00,66.00
Sharon, 56.00,42.00,28.00,70.00
Roy, 80.00,105.00,55.00
Beatrice, 20.00
Step 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