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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education