Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The sales program found below is currently missing three desired pieces of functionality---it doesn't store record sales, nor is it able to print the top
- The sales program found below is currently missing three desired pieces of functionality---it doesn't store record sales, nor is it able to print the top most expensive sales. Provided for you is the RecordSale class which contains the album title and sale price for a particular record, and the SalesHistory class which is responsible for maintaining the list of past sales.
- Your task is to implement this missing functionality by defining two additional methods in the SalesHistory class: a) add_sale, and b) print_top_sales.
- a) Defining the add_sale method This method takes an album title and its sale price as arguments instantiates a new RecordSale object, and then appends it to the sales instance variable (which is a list).
- b) Defining the print_top_sales method This method takes no arguments and prints the album title and sale price of the top three most expensive sales in descending order of price (i.e. highest to lowest). Each line in the output should be numbered (see example run). In order to sort the auction sale items you should use the sort list method (documented here). You will need to make use of the sort method's two named arguments when calling it.
Step by Step Solution
★★★★★
3.32 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Heres the modified SalesHistory class with the missing functionality python class RecordSale def ini...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