Question: This program is built on the Object Oriented Programming concept of Aggregation, where you build complex objects comprised of other objects. You will code 3
This program is built on the Object Oriented Programming concept of Aggregation, where you build
complex objects comprised of other objects.
You will code classes. The Student class, which uses the Library which consists of Books. There is not
any inheritance in this project.
The Book class.
Attributes in init: title, isbn, author. Make these attributes nonpublic.
Use @property to make all of these readonly attributes. No setter methods these attributes
cannot be modified.
Method: displayBook. This method should consist of a print statement that prints the title, author
and isbn of the book. see Example
The Library class.
Attributes in init: Takes an argument listofbooks. This is assigned to an attribute:
availablebooks. Another attribute called listofborrowedbooks is initialized to an empty list.
Method : displayAvailableBooks. No arguments. This method will process the list of available
books and print all the books in the list using the method in the Book class.
Method : lendBook. Argument: requestedbooktitle. This method will check to see if the
requestedbooktitle is in the availablebooks. If so then it will let you know you can borrow it and
then remove the book from the availablebooks and place it in the borrowedbooks.
Method : addBook. Argument: returnedbooktitle. This method will check to see if the
returnedbooktitle is in the list of borrowed books. If so then it will add that book to the available
books list and remove it from the borrowed books.
NOTE: For methods and you will need to use a loop to process the list. Include logic that will
alert the user if no action was taken.
The Student class.
Attributes: for simplicity, this class does NOT have an init method, nor does it have any
attributes. Instead, it consists of two methods.
Method : requestBook. No arguments. The method asks the user to enter the title of the book
they would like to borrow and returns this title.
Method : returnBook. No arguments. The method asks the user to enter the title of the book they
are returning and returns this title.
In the main:
Create different book instances.
Create a library instance and sent it a list of the books.
Create a student instance.
The following action exists inside of a while loop.
o Display a menu with choices: Display the list of books, Request a book, Return a book,
Exit
o The user then enters their choice as an integer.
o Then in an ifelif... structure, depending upon the choice, fulfill the students request.
Different choices will require you to use methods in the Student class or in the Library
class, or both... make sure to make comments to understand easily
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
