The sales program found below is currently missing three desired pieces of functionality---it doesn't store record sales,
Fantastic news! We've Found the answer you've been seeking!
Question:
- 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.
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date: