Page 1 of 1

Introduction This assignment is designed to test your understanding of inheritance, polymorphism and File 10 in Python.

Posted: Sat May 14, 2022 7:18 pm
by answerhappygod
Introduction This Assignment Is Designed To Test Your Understanding Of Inheritance Polymorphism And File 10 In Python 1
Introduction This Assignment Is Designed To Test Your Understanding Of Inheritance Polymorphism And File 10 In Python 1 (94.54 KiB) Viewed 51 times
assignment 1 files
A1.py file
A1_functions.py
book.py
users.py
please do the assignment content as in the requrments using
python only
Introduction This assignment is designed to test your understanding of inheritance, polymorphism and File 10 in Python. No prior knowledge is required however attendance and understanding of the content of the lectures given and posted on D2L so far is absolutely required to finish this assignment. The ideal way to do this assignment is to study the lectures, do the labs, jot down any questions and ask your instructor or TA, plan the implementation and then finally code the assignment. Objective To test your understanding of the following: Review of basic OOP programming basics done in assignment 1 • Inheritance child-parent relationships Polymorphism and method overriding Working with files to save and retrieve class objects using CSV and JSON formats. General Guidelines When Writing Programs At the top of your program you should write your name, student ID and information about your assignment # Assignment (number) # Written by: (your name and student id) # In a comment, give a general explanation of what your program is doing. The more complicated the program is the more elaborative your comments should be. Using comments explain every major step in the program as you implement it. • All user prompts MUST be clear and informative for the user whether you are asking for input or displaying outputs. Always start and end the program with descriptive and informative messages to the users.

Assignment explanation Building upon assignment 1, we want to extend this program to be an online portal supporting multi libraries with different requirements and different types of users. The additional functionality will be as follows: Three library types will be supported: o Online school library Online municipal library o Online national library All three libraries will share some properties and methods. You can deduct those properties and methods from what you have done in assignment 1. Likely, you didn't implement the library as a separate class in A1 given that you only had a single library and there was no point of instantiating more than library object from a class. Nevertheless, here you should consider having a class that contains all common behaviour and properties and then add to it any special extensions. A non-exhaustive list of the properties and methods are as follows: (note: feel free to add any additional property or method you deem is necessary) o Properties: Library name Library type • Allowed list of user types (contains the types of users that are allowed exist in this library) • List of already registered users • List of restricted users • List of books in this library · Borrowing policy in terms of: loan period, grace period, number of times to extend loan before default. List of active book loans o Methods: Constructor that takes all properties as parameters and have default values set in case the programmer didn't enter all the fields when constructing an object. Add a user: to add new user to the library. It should accept all user details and the user type to create a new user in case the user doesn't exist in the list of users, OR add an existing user object to the list of library users in case the user already exists but wasn't a member of this specific library. • Add a book to add a new book to the library. Again, it will accept all the book details and create a new book object in case it didn't exist in the list of books, OR just add existing book object to the list of library books in case the book already exists but wasn't a part of this library's collection. Remove a user to take off the user from the list of library users and return all his borrowed books to the list of available books

Restrict a user: applying some restrictions on the user; such as temporarily banning a user from borrowing library books due to excessive abuse of the loan period. Remove a book: to take off the book from the library's list • Add/change borrowing policy: to adjust the details of the borrowing policy to which any new book rentals should comply. • Borrow a book: to check out a book to a user and take it off the library's list of available books. Before checking out, it checks if the patron has any past due amounts or is restricted from using the library for any reason. Also after, it should update different lists with the new loan details. . Return a book: return the book from the user back to the library inventory and checks if it's past due and apply any charges or penalty on the user. · Search for a book: search inside the list of library books using: title or author names and return a reference pointing to the book of interest. Get library stats: return useful statistics such as the frequently borrowed books, highest borrowing users and books pending returns. This could help library managers to decide which books they should buy additional copies for, extending or reducing loan period/policy and any other decision regarding the return process. Additionally, each library will have its own additional methods or its own implementation of the above methods as follows: (NOTE: again feel free to add any additional property or method you deem is necessary) School library: will have few changes from above as follows: Add user: should check that the user to be added is a: student, librarian or admin only. Borrow a book: works only for students, so validating if a student before checking out is important. • Municipal library: will have the following changes: Add user: should check that the user lives in the same municipality in order to be added. o Borrow a book: should ensure that the user has a credit card registered on file to ensure that any dues will be charged automatically. National library: will have the following changes: Add user: should check that the user an adult and has a social security number in order to be added. o Borrow a book: should ensure that the user has a credit card registered on file to ensure that any dues will be charged automatically. • The following simple UML diagram explains the relationship between different classes mentioned above. Again, this is a simple and not an exhaustive UML with all possible relationships so feel free to add any additional relationship you deem necessary for your code. Additionally, neither properties nor behaviour is illustrated in this UML so you need to update it

to include all properties and methods from A1 in addition to the new properties and methods added in this assignment. has Libran aburrows from User returns to has Scho Municbat.ba Nationary C Back @Regular Student Ammin Librarian • All the data that you store inside the lists of books, users or libraries MUST be saved to a JSON file before you exit the program and MUST reloaded when you start the program. This will ensure that you always keep your data and never have to start from scratch every time you run the program. Finally, you MUST include a readme file for your program explaining how it operates, what sort of prompts the user will face and what he should do to achieve different functionalities. Important things to consider when building this program: • The type of classes that you create. You should clearly specify which are supposed to be classes and which should be class members and not a class in its own. • All necessary methods for every class including all setters, getters and other mutator methods. • Constructors and what they should initialize. • Differentiate clearly between instance variable and class variables. Justify the need for class variables in case they are needed. • Storing users and books references can be done inside a list or similar data structures before saving them to a JSON file before exiting.