Question: First, write a class named Movie that has four data members: title , genre , director , and year . It should have: an init

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

Step by Step Solution

3.40 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the implementation of the three classes Movie StreamingService and StreamingGuide as described ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!