subject
Chemistry, 02.05.2021 01:00 Spoiledgirl2905

Special Methods and Inheritance Purpose: After completing this assignment, you will have practiced overloading operators for a programmer-defined class and using inheritance. Description For this assignment you will write a program to simulate a media library. We will work with three types of media: pictures, music, and movies. Your job is to design and implement a class hierarchy consisting of the Media, Picture, Song, and Movie classes, as described below. Specification for the classes: All the following classes are to be implemented in a single module media. py. Media class The Media class will be the abstract base class to be inherited by our Song, Movie and Picture classes. All Media objects should have a name and a rating. The rating is an integer number (think of this as the number of stars given) We will leave many design decisions to you, however you should implement at least the following methods: . __init__(name, rating) Where name is a string and rating is an integer. • getName() Returns the name of the Media as a string . __str_ Returns a string representation of a generic Media object.
• getRating Returns the rating as an integer.
• setRating(value). Takes an integer parameter, and changes the rating of the object. In addition, you should have a static abstract method add that takes no parameters.
Movie class A Movie is a type of Media that has a director and running time (given in minutes). This class has a play() method that will simulate the task of playing a movie (you can do something simple as printing: '<>, playing now'. The Movie class should override the __str_(or __repr_) method of its parent Media class (although it can also use it!). Make sure you also implement at least the following methods:
• A constructor. Your constructor should take all the information needed to initialize the parent class, as well as the director as a string and the running time as a number.
• getDirector() Returns the director as a string
• setDirector(name) Sets the director using the string name.
• getRunningTime() Returns the running time as a number.
• setRunningTime (time) Sets the running time using the integer time.
• play() Prints out information about the Movie object in the format: <>, <> stars, Directed by: <>, Running time: <> minutes.
• _str__() or _repr_ Returns a string representation of the Media object. If done smartly, this can be used by the play() method. In addition you will have to implement the add method for this class.

ansver
Answers: 2

Other questions on the subject: Chemistry

image
Chemistry, 22.06.2019 00:30, ooferson
What must happen before a body cell can begin mitotic cell division
Answers: 1
image
Chemistry, 22.06.2019 03:00, coombsbob
Which of the dna typing techniques do you think you would choose if you had to analyze a dna sample? why?
Answers: 1
image
Chemistry, 22.06.2019 11:00, shimonypuck28
Hey can you me with this i really need y’all
Answers: 1
image
Chemistry, 22.06.2019 13:30, rudolph34
Apush or pull that moves or changes and object when to objects touch
Answers: 2
You know the right answer?
Special Methods and Inheritance Purpose: After completing this assignment, you will have practiced o...

Questions in other subjects:

Konu
Mathematics, 04.11.2019 06:31