Question: Please come up with report based on phython programing in library Management System from given information. This report should provide Executive Summary, introduction, method and
Please come up with report based on phython programing in library Management System from given information. This report should provide Executive Summary, introduction, method and detail of each class and coding The primary objective of this application is to manage library operations, particularly focusing on the borrow
and return process for books.
Detailed Requirements
Book Class:
Properties:
Title
Author
ISBN
Availability status
Methods:
Constructor to initialize the four key properties User Class:
Properties:
UserID
Name
List of borrowing history
List of current history
Total fines
Methods:
Constructor to initialize the five key properties Checkout Class:
Properties:
List of borrowed books
Due dates
Total fines
Methods:
Default constructor to initialize a new LibraryCheckout object.
borrowbooksomeuser, somebook: Method to handle the borrowing of a book.
returnbooksomeuser, somebook: Method to handle the return of a borrowed book.
Assume $ fine per day
printreceiptsomeuser: Method to print a receipt of the transaction.
rom datetime import datetime, timedelta
# Book Class
class Book:
def initself title, author, isbn, availabilityTrue:
self.title title
self.author author
self.isbn isbn
self.availability availability
def strself:
return fselftitle by selfauthorISBN: selfisbn
# User Class
class User:
def initself userid name:
self.userid userid
self.name name
self.borrowinghistory # To store all borrowed books including returned
self.currentbooks # Books currently borrowed by the user
self.totalfines # Track the user's total accumulated fines
def borrowbookself book:
# Adds a book to the user's current borrowed books
self.currentbooks.appendbook
def returnbookself book:
# Removes a book from current borrowed list and adds it to borrowing history
if book in self.currentbooks:
self.currentbooks.removebook
self.borrowinghistory.appendbook
def addfineself amount:
# Adds a fine to the user's total
self.totalfines amount
def strself:
return fUser: selfname ID: selfuserid Total Fines: $selftotalfines:f
# LibraryCheckout Class
class LibraryCheckout:
def initself:
self.borrowedbooks # Stores books and their due dates
def borrowbookself user, book:
if book.availability:
duedate datetime.now timedeltadays # day loan period
self.borrowedbooksbook duedate
book.availability False
user.borrowbookbook
printfBook book borrowed by username Due on duedate.strftimeYmd
else:
printfBook booktitle is currently unavailable."
def returnbookself user, book, returndateNone:
if book in user.currentbooks:
duedate self.borrowedbooks.popbook None
user.returnbookbook
book.availability True
# If returndate is None, use current date realtime return
if not returndate:
returndate datetime.now
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
