Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create the following classes and a main program for a simple library management system: LibraryItem Class: Attributes: title ( String ) , creator ( String

create the following classes and a main program for a simple library management system:
LibraryItem Class:
Attributes: title (String), creator (String), itemId (int), available (boolean)
Methods: checkoutItem(), returnItem(),isAvailable(),getItemId(), toString()[optional]
Book Class (extends LibraryItem):
Attributes: genre (String), numberOfPages (int)
Constructor: Book(String title, String creator, int itemId, String genre, int numberOfPages)
Method: toString()[optional]
DVD Class (extends LibraryItem):
Attributes: director (String), duration (int)
Constructor: DVD(String title, String creator, int itemId, String director, int duration)
Method: toString()[optional]
LibraryMember Class:
Attributes: name (String), address (String), contact (String), memberId (int), borrowedItems (array of LibraryItem), fines (double)
Constructor: LibraryMember(String name, String address, String contact, int memberId)
Methods: borrowItem(LibraryItem item), returnItem(LibraryItem item), toString()[optional]
Library Class:
Attributes: items (array of LibraryItem), members (array of LibraryMember)
Constructor: Library()
Methods: addItem(LibraryItem item), addMember(LibraryMember member), toString()
Main Class:
Create a Library object.
Use a menu-driven console interface to:
Add items (books or DVDs) to the library.
Add members to the library.
Allow members to borrow items.
Allow members to return items.
Display the library's state.
Exit the program.
Ensure the user can interact with the library management system through the console interface, using simple arrays for managing items and members.
Sample output:
1. Add item
2. Add member
3. Borrow item
4. Return item
5. Display library
6. Exit
Enter your choice: 1
Enter title: The Great Gatsby
Enter creator: F. Scott Fitzgerald
Enter item ID: 1
Is it a book or a DVD (B/D): B
Enter genre: Fiction
Enter number of pages: 180

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

l Diagram the sequence of a typical selection process.

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago