In: Physics
Why was it unnecessary to connect the ground alligator clip in the Oscilloscope experiment
In: Physics
Ways and sugesstions to improve Aldol Reaction: Dibenzalacetone lab/ experiment?
In: Chemistry
What the method and results of blood grouping and blood typing experiment.
In: Biology
Describe elements of classical conditioning by applying the Pavlov's experiment with a dog.
In: Psychology
What is the advantage of using an internal standard in a gas chromatography experiment?
In: Chemistry
Discuss the Utility of concomitant variable in design of experiment. Thank you
In: Statistics and Probability
Compare any new obedience study to Milgrims obedience experiment.
In: Psychology
Which experiment investigated the question, “Do animals have morality?”
In: Psychology
QUESTION 13
Implement in Python and test the classes shown in the UML below. The LibraryItem class shown in the UML, represents an item that the library issues to students. The partial Python code is provided and It has the following attributes. Test the program by creating a list of books and a list of DVDs and printing the details of each element in the list.
|
Attribute |
Description |
|
ID |
The ID of the item. |
|
createdate |
The date the item was created as dd/mm/yyyy |
|
title |
The title of the item. |
class LibraryItem:
def __init__(self,ID="",year=0,title=""):
self.ID=ID
self.year=year
self.title=title
def getLoanPeriod(self):
return 0
A) Implement the Book class. It inherits from LibraryItem. Furthermore, it has this additional attribute
|
Attribute |
Description |
|
author |
The author of the book |
|
Electronic |
This tells whether the book is available as an electronic book (e book) |
Implement the getLoanPeriod function in this way:
- If the book was written before the year 2000, the loan period will be 14 days.
- If the book was written after or in 2000, the loan period will be 7 days.
B) Implement the DVD class. It inherits from LibraryItem. Furthermore, it has this additional attribute
|
Attribute |
Description |
|
length |
The length of the DVD. Example: “2 hours: 30 minutes” |
|
HD |
Whether the DVD is available in HD (High Definition) or not |
Implement the getLoanPeriod function in this way:
- If the DVD is available in HD format, the loan period will be 3 days. Otherwise, the loan period will be 7 days.
In: Computer Science