Question: NEED HELP FROM A HUMAN BEING!!!! You will be writing a Library simulator involving multiple classes. You will write the LibraryItem, Patron and Library classes,
NEED HELP FROM A HUMAN BEING!!!! You will be writing a Library simulator involving multiple classes. You will write the LibraryItem, Patron and Library classes, and the three classes that inherit from LibraryItem Book Album and Movie All data members of each class should be marked as private a leading underscore in the name Since they're private, if you need to access them from outside the class, you should do so via get or set methods. Any get or set methods should be named per the usual convention get or "set followed by the name of the data memberYou MUST: Create two books; Create two patrons; Add books and patrons to library holdingsmembership; Increment date, have patron pay fine, check fine amount. Here are descriptions of the three classes:LibraryItem:A LibraryItem object represents a library item that a patron can check out from a library. It has six data members:libraryitemid a unique identifier for a LibraryItem you can assume uniqueness, you don't have to enforce ittitle cannot be assumed to be uniquelocation a LibraryItem can be ONSHELF", ONHOLDSHELF", or "CHECKEDOUT"checkedoutby refers to the Patron who has it checked out if anyrequestedby refers to the Patron who has requested it if any; a LibraryItem can only be requested by one Patron at a timedatecheckedout when a LibraryItem is checked out, this will be set to the currentdate of the LibraryThe LibraryItem methods are:init method takes a library item ID and title as parameters; checkedoutby and requestedby should be initialized to None; a new LibraryItem's location should be on the shelfgetlocation returns the Library Item's locationother get and set methods as neededBookAlbumMovie:These three classes all inherit from LibraryItemAll three will need an additional data member. For Book, it's a string called author. For Album, it's a string called artist. For Movie, it's a string called directorEach of the new data members will need a get method to return its valueAll three will need a method called getcheckoutlength that returns the number of days that type of library item may be checked out for. For a Book it's days, for an Album it's days, and for a Movie it's daysPatron:A Patron object represents a patron of a library. It has four data members:patronid a unique identifier for a Patron you can assume uniqueness, you don't have to enforce itname cannot be assumed to be uniquecheckedoutitems a collection of LibraryItems that a Patron currently has checked outfineamount how much the Patron owes the Library in late fines measured in dollars; this is allowed to go negativeThe Patron methods are:init method takes a patron ID and name as parametersgetfineamount returns the fineamountother get and set methods as neededaddlibraryitem adds the specified LibraryItem to checkedoutitemsremovelibraryitem removes the specified LibraryItem from checkedoutitemsamendfine a positive argument increases the fineamount, a negative one decreases it; this is allowed to go negativeLibrary:A Library object represents a library that contains various library items, and is used by various patrons. It has three data members:holdings a collection of the LibraryItems that belong to the Librarymembers a collection of the Patrons who are members of the Librarycurrentdate stores the current date represented as an integer number of "days" since the Library object was createdThe Library methods are:an init method that initializes the holdings and members as empty collections and initializes the currentdate to zeroaddlibraryitem takes a LibraryItem object as a parameter and adds it to the holdingsaddpatron takes a Patron object as a parameter and adds it to the memberslookuplibraryitemfromid returns the LibraryItem object corresponding to the ID parameter, or None if no such LibraryItem is in the holdingslookuppatronfromid returns the Patron object corresponding to the ID parameter, or None if no such Patron is a membercheckoutlibraryitemtakes as parameters a patron ID and a library item ID in that orderif the specified Patron is not in the Library's members, return "patron not found"if the specified LibraryItem is not in the Library's holdings, return "item not found"if the specified LibraryItem is already checked out, return "item already checked out"if the specified LibraryItem is on hold by another Patron, return "item on hold by other patron"otherwise update the LibraryItem's checkedoutby datecheckedout and locationif the LibraryItem was on hold for this Patron, update requestedbyupdate the Patron's checkedoutitemsreturn "check out successful"returnlibraryitemtakes as its parameter a library item IDif the specified LibraryItem is not in the Library's holdings, return "item not found"if the LibraryItem is not checked out, return "item already in library"update the Patron's checkedoutitemsupdate the LibraryItem's location depending on whether another Patron has requested it if so it should go on the hold shelfupdate the LibraryItem's checkedoutbyreturn "return successful"requestlibraryitemtakes as parameters a patron ID and a library item ID in that orderif the specified Patron is not in the Library's members, return "patron not found"if the specified LibraryItem is not in the Library's holdings, return "item not found"if the specified LibraryItem is already requested, return "item already on hold"update the LibraryItem's requestedbyif the LibraryItem is on the shelf, update its location to on holdreturn "request successful"payfinetakes as parameters a Patron ID and the amount in dollars being paid in that orderif the specified Patron is not in the Library's members, return "patron not found"use amendfine to update the Patron's fine; return "payment successful"incrementcurrentdatetakes no parametersincrement current dateincrease each Patron's fines by cents for each overdue LibraryItem they have checked out by calling amendfineNote a LibraryItem can be on request without its location being the hold shelf if another Patron has it checked out;One limited example of how your classes might be used is: b Book "Phantom Tollbooth", "Juster" a AlbumAnd His Orchestra", "The Fastbacks" m Movie "Laputa", "Miyazaki" printbgetauthor printagetartist printmgetdirector p Patronabc "Felicity" p Patronbcd "Waldo" lib Library lib.addlibraryitemb lib.addlibraryitema lib.addlibraryitemm lib.addpatronp lib.addpatronp lib.checkoutlibraryitembcd for in range: lib.incrementcurrentdate # days pass lib.checkoutlibraryitemabc loc agetlocation lib.requestlibraryitemabc for in range: lib.incrementcurrentdate # days pass pfine pgetfineamount lib.payfinebcd pfine lib.returnlibraryitemYou are responsible for testing all of the required functions to make sure they operate as specified.Your file must be named: Library.pyJust to think about: Since there are three possible locations for a LibraryItem, there are six hypothetical changes in location. Are all six possible according to these specifications?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
