Question: In Java please. You are tasked with developing a Library Management System. The system should manage different types of library items: Books, Magazines, and DVDs

In Java please.
You are tasked with developing a Library Management System. The system should manage different types of library items: Books, Magazines, and DVDs. Each type of item will implement specific rules for calculating late fees, and you will integrate an interface to enforce that all library items can calculate late fees and display details.
Requirements
1. Create an Interface: ILibraryItem
Methods:
void displayDetails(): Print the details of the library item. double calculateLateFee(int daysLate): Calculate the late fee for the item.
2. Create a Base Class: LibraryItem
Implements: The ILibraryItem interface.
Fields:
String title: The title of the item. String author: The author (or publisher for magazines/DVDs) of the item.
Constructor:
Initialize the fields title and author.
Methods:
Implement the displayDetails() method to print the title and author of the item. Leave the calculateLateFee() method abstract to enforce implementation by subclasses.
3. Create Subclasses
Book
Implements: Inherits from LibraryItem and implements calculateLateFee() based on the rule:
Late Fee Rule: $0.50 per day late.
Override the calculateLateFee() method to implement this rule.
Magazine
Implements: Inherits from LibraryItem and implements calculateLateFee() based on the rule:
Late Fee Rule: $1.00 per day late.
Override the calculateLateFee() method to implement this rule.
DVD
Implements: Inherits from LibraryItem and implements calculateLateFee() based on the rule:
Late Fee Rule: $1.50 per day late.
Override the calculateLateFee() method to implement this rule.
4. Demonstrate Polymorphism in the main Method
Create an array of type ILibraryItem and populate it with:
One Book object. One Magazine object. One DVD object.
Use a loop to:
Call displayDetails() for each item. Call calculateLateFee() for each item with a value of 5 days late and print the fee.
Sample output:
Title: The Great Gatsby
Author: F. Scott Fitzgerald
Late Fee for 5 days: $2.5
Title: Time Magazine
Author: Time Publishers
Late Fee for 5 days: $5.0
Title: Inception
Author: Christopher Nolan
Late Fee for 5 days: $7.5
In Java please. You are tasked with developing a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!