Answered step by step
Verified Expert Solution
Link Copied!

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

  1. 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. 

  2. 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. 

  3. 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). 

  4. 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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Programming questions

Question

=+5. Briefly discuss in-links, out-links, and co-links.

Answered: 1 week ago

Question

Explain the extent to which trade names are protected.

Answered: 1 week ago