First, write a class named Movie that has four data members: title , genre , director ,
Fantastic news! We've Found the answer you've been seeking!
Question:
First, write a class named Movie that has four data members: title, genre, director, and year. It should have:
- an init method that takes as arguments the title, genre, director, and year (in that order) and assigns them to the data members. The year is an integer and the others are strings.
- get methods for each of the data members (get_title, get_genre, get_director, and get_year).
Next write a class named StreamingService that has two data members: name and catalog. the catalog is a dictionary of Movies, with the titles as the keys and the Movie objects as the corresponding values (you can assume there aren't any Movies with the same title). The StreamingService class should have:
- an init method that takes the name as an argument, and assigns it to the name data member. The catalog data member should be initialized to an empty dictionary.
- get methods for each of the data members (get_name and get_catalog).
- a method named add_movie that takes a Movie object as an argument and adds it to the catalog.
- a method named delete_movie that takes a movie title as an argument and if that Movie is in the catalog, removes it.
Lastly, write a class named StreamingGuide that has one data member, a list of StreamingService objects (you can assume there aren't any StreamingServices with the same name). It should have:
- an init method that takes no arguments and initializes the data member to an empty list.
- a method called add_streaming_service that takes a StreamingService object as an argument and adds it to the list.
- a method named delete_streaming_service that takes the name of a streaming service as an argument and if it's in the list, removes it.
- a method named who_streams_this_movie that takes a movie title as a parameter and returns either a dictionary or the value None. The dictionary should contain 3 key-value pairs with the keys 'title', 'year', and 'services'. The value for 'title' should be the title of the movie (which was passed to this function as a parameter). The value for 'year' should be the year of that movie, as an integer. The value for 'services' should be a list of the names of the streaming services showing that movie. If the movie is not available on any of the StreamingServices, then instead of returning a dictionary, the method should return None.
Related Book For
Concepts of Database Management
ISBN: 978-111182591
7th edition
Authors: Philip J. Pratt, Joseph J. Adamski
Posted Date: