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 19:00
Which term best describes the form sound takes as it travels away from a drum (a- gas)(b-music) ( c-waves) (d-particles
Answers: 3
question
Chemistry, 22.06.2019 16:00
Uranium can supply energy for the worlds electricity without admitting harmful greenhouse gases which of these statements best describes an outcome of uranium mining
Answers: 1
question
Chemistry, 22.06.2019 20:00
There are two steps in the usual industrial preparation of acrylic acid, the immediate precursor of several useful plastics. in the first step, calcium carbide and water react to form acetylene and calcium hydroxide: cac2 (s) + 2h2o (g) → c2h2 (g) + caoh2 (s) =δh−414.kj in the second step, acetylene, carbon dioxide and water react to form acrylic acid: 6c2h2 (g) + 3co2 (g) + 4h2o (g) → 5ch2chco2h (g) =δh132.kj calculate the net change in enthalpy for the formation of one mole of acrylic acid from calcium carbide, water and carbon dioxide from these reactions. round your answer to the nearest kj .
Answers: 3
question
Chemistry, 23.06.2019 04:10
In an experiment, 45g of silicon tetrachloride are treated with 45ml of water. what is the theoretical yield in grams of hcl
Answers: 3
You know the right answer?
Special Methods and Inheritance Purpose: After completing this assignment, you will have practiced o...
Questions
question
Mathematics, 21.03.2020 12:03
question
Social Studies, 21.03.2020 12:03
question
English, 21.03.2020 12:03
Questions on the website: 13722367