you will be writing a paython program for a company to load saved sales data from a file and view certain information about each customer. First, create a file in your project named sales.txt and add the following data: Steve123 11/23/21 50.41 Customer1 11/23/21 500 JanetG 1/2/22 25.37 Customer1 2/15/22 250 Steve123 3/17/22 18.75 UserName 4/12/22 2.50 FrankF 5/17/22 30 FrankF 6/10/22 42.50 JanetG 12/15/22 25 FrankF 1/23/23 50.15 Each line contains information about a single sale: The username of the customer, the date of the sale, and the amount of the sale. Aside from main, your program should include the following two functions: load_data: Creates a dictionary in which every key is a customer name, and every value is a list containing the amount of each of their sales. Returns the dictionary. print_customer_info: Accepts the dictionary and a customer name as parameters. Prints out the following information about the given customer in a nicely formatted way: the number of sales they made, the total of all their sales added up, and the average amount per sale. In your program's main function, call load_data and assign the returned dictionary to a variable. Then, continually ask the user which customer they would like to see information for (or if they'd like to quit). If the customer does not exist in the dictionary, the program shouldn't crash (you can avoid this in whichever way you prefer). Otherwise, call the print_customer_info function passing the dictionary and the name.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

, you will be writing a paython program for a company to load saved sales data from a file and view certain information about each customer. First, create a file in your project named sales.txt and add the following data: Steve123 11/23/21 50.41 Customer1 11/23/21 500 JanetG 1/2/22 25.37 Customer1 2/15/22 250 Steve123 3/17/22 18.75 UserName 4/12/22 2.50 FrankF 5/17/22 30 FrankF 6/10/22 42.50 JanetG 12/15/22 25 FrankF 1/23/23 50.15 Each line contains information about a single sale: The username of the customer, the date of the sale, and the amount of the sale. Aside from main, your program should include the following two functions: load_data: Creates a dictionary in which every key is a customer name, and every value is a list containing the amount of each of their sales. Returns the dictionary. print_customer_info: Accepts the dictionary and a customer name as parameters. Prints out the following information about the given customer in a nicely formatted way: the number of sales they made, the total of all their sales added up, and the average amount per sale. In your program's main function, call load_data and assign the returned dictionary to a variable. Then, continually ask the user which customer they would like to see information for (or if they'd like to quit). If the customer does not exist in the dictionary, the program shouldn't crash (you can avoid this in whichever way you prefer). Otherwise, call the print_customer_info function passing the dictionary and the name. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Files and Directory
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning