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, 22.06.2019 06:40
Which statement is usually true about the relationship between activation energy and reaction rates? low activation energy barriers result in low rates. high activation energy barriers result in low rates. low activation energy barriers result in no reaction. high activation energy barriers result in no reaction.
Answers: 3
question
Chemistry, 22.06.2019 12:20
Adeuteron, 21h, is the nucleus of a hydrogen isotope and consists of one proton and one neutron. the plasma of deuterons in a nuclear fusion reactor must be heated to about 3.02×108 k . what is the rms speed of the deuterons? express your answer using two significant figures.
Answers: 1
question
Chemistry, 22.06.2019 13:30
An animal cell loses the ability to convert energy stored in food to energy that the cell can use. which of the cell's organelles has stopped working? a.the mitochondria b.the nucleus c.the vacuoles d.the endoplasmic reticulum
Answers: 1
question
Chemistry, 23.06.2019 04:10
What does the field of thermodynamics relate to a-changes in nuclear reactions b- changes in energy in systems c changes in molecular structure d changes in atomic properties
Answers: 1
You know the right answer?
Special Methods and Inheritance Purpose: After completing this assignment, you will have practiced o...
Questions
question
Mathematics, 09.10.2021 14:00
Questions on the website: 13722361