Question: Design a Python class named LibraryItem to represent items in a library with the following attributes and methods: Attributes: . item _ id ( integer
Design a Python class named LibraryItem to represent items in a library with the following attributes and methods:
Attributes:
itemid integer: An ID for the library item default
title string: The title of the item default "Unknown"
checkedout boolean: A flag indicating if the item is currently checked out default False
duedate string: The due date for the item default "Not Checked Out"
latefeeperday float: The late fee per day for the item default
Methods:
self itemid title: A constructor that initializes the library item with the specified item ID and title.
checkoutself duedate: A method that allows a library user to check out the item. It should set the checkedout flag to True and update the duedate attribute with the provided due date.
displayinfoself: A method that returns a string containing information about the library item in the following format: "Item ID: itemid Title: title, Checked Out: checkedout, Due Date: duedate".
Write a test program that does the following:
Create a LibraryItem object representing a book with an item ID of a title of "The Great Gatsby".
Use the checkout method to check out the book with a due date of
Print the information of the library item using the displayinfo method.
Example Output:
Item ID: Title: The Great Gatsby, Checked Out: False, Due Date:
Constraints:
The itemid should be a positive integer.
The title should be a nonempty string.
Python
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
