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

Another question on Chemistry

question
Chemistry, 21.06.2019 22:00
If 1.63 times 10 negative 4 of helium dissolves in 100.0g of water, what is the concentration in parts per million
Answers: 3
question
Chemistry, 22.06.2019 01:30
__can be defined as which velocity changes
Answers: 1
question
Chemistry, 22.06.2019 16:30
4. a 20-kg child is tossed up into the air by her parent. the child is 2 meters off the ground traveling 5 m/s. circle one: ke / gpe / both show your work for finding the values of each type of energy the object has:
Answers: 1
question
Chemistry, 22.06.2019 18:30
Which rate indicates the number of children that would be born per woman if she were to live to the end of her child bearing years
Answers: 2
You know the right answer?
Special Methods and Inheritance Purpose: After completing this assignment, you will have practiced o...
Questions
question
Chemistry, 14.12.2020 19:20
question
Mathematics, 14.12.2020 19:20
question
Mathematics, 14.12.2020 19:20
question
Geography, 14.12.2020 19:20
question
Biology, 14.12.2020 19:20
Questions on the website: 13722362