You have decided to bring back the glory that is Blockbuster Video. In order to accomplish your goal, you are designing the part of the backend system for your online store. Thankfully, you know that classes and objects will be a major help to you on this endeavor. This assignment gives you practice writing custom classes and objects in Python. Implement the two classes and their methods described on the next page.

class Movie: Represents a movie with a proper title, a barcode so it can be sold, a particular genre, and a rating (out of 100) based on the quality of the film.
• def init__(self, title, genre, barcode, rating=0.0): assigns all non-self parameters to fields of the same name (this is the most common kind of python constructor). All fields are strings with the exception of rating, which is a floating point number.
• def str (self): returns a str that follows this pattern:
o "#1234: TheFilm - Genre (45.7%)"
• def repr__(self): returns a str that follow this pattern:
o 'Movie("TheFilm", "Genre", "1234", 45.7)'
• def eq (self,other): both parameters are Movies. returns True when both movies have the same four fields, returns False otherwise.
• def adjust_rating(self, amount=0): change the rating of this Movie by the given amount. The maximum rating is 100, and the minimum rating is 0. If a change would go above the max or below the min, set the rating to the maximum or minimum respectively.

class MovieStore: Represents a store that sells movies. It keeps track of the movies it has in a list
• def init__(self, name, inventory=None): assigns all non-self parameters to fields of the same name. if inventory==None, a new empty list is created as the value for this field instead.
• def str (self): returns a str that follows the pattern below. Note, you should try to use the str definition from Movie here (that's the learning goal). use "<empty>" if there are no movies—

"Store inventory: #1234: FilmA - Genre (45.7%), #5678: FilmB – Genre (97.5%)" "Store inventory: <empty>"

• def repr__(self): returns a str that follows pattern below. Note, you should try to use the repr definition from Movie here (that's the learning goal)—

'MovieStore("Store", [Movie("FilmA", "Genre", "1234", 45.7), Movie("FilmB", "Genre", "5678", 97.5)])'

• def buy(self, movie): add a movie to the store's inventory. Recently purchased movies should always go to the end of the movies list.
• def sell(self, movie): removes the given movie from the store's inventory. You can only sell movies you have already! If you have more than one copy of this movie, sell just the first one.
• def clear_inventory(self): removes all movies with less than 50% rating from your inventory
• def lookup(self, movie): returns True if you have the movie in your inventory, False otherwise
• def recommend(self, genre): returns the title of the highest rated movie in your inventory in a specific genre. If there are more than one movie with the highest rating, return the last one in your inventory. If there are no movies to recommend, return an empty string.
• def appraise(self, adjustments): given a dictionary of movie barcodes and an amount to shift that movie's rating by, apply each ratings adjustment to each movie accordingly. If a barcode does not exist in your inventory, just ignore it.
• def top_results(self, genre, percent): returns a list (in ascending sorted order) of the movies in a given genre that are at or above a particular rating percent.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

class Movie:
    def __init__(self, title, genre, barcode, rating=0.0):
       self.title = title
       self.genre = genre
       self.barcode = barcode
       self.rating = rating

    def __str__(self):
       return "#" + str(self.barcode) + ": " + str(self.title) + " - " + str(self.genre) + " (" + str(
            self.rating) + "%)"

    def __repr__(self):
       return "Movie(" + '"' + str(self.title) + '"' + ", " + '"' + str(self.genre) + '"' + ", " + '"' + str(
            self.barcode) + '"' + ", " + str(self.rating) + ")"

    def __eq__(self, other):
       return self.title == other.title and self.genre == other.genre and self.barcode == other.barcode and self.rating == other.rating

    def adjust_rating(self, amount=0):
       if self.rating + amount > 100:...

By purchasing this solution you'll be able to access the following files: and

50% discount

$28.00 $14.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats