help on the following classes and main program for simple library management system? 1. LibraryItem Class: -
Question:
help on the following classes and main program for simple library management system?
1. LibraryItem Class:
- Attributes: title (string), creator (string), itemId (int), available (boolean)
- Methods: checkoutItem(), returnItem(), isAvailable(), getItemId(), toString() [optional]
2. Book Class (extends LibraryItem):
- Attributes: genre (String), numberOfPages (int)
- Constructor: Book (String title, String creator, int itemId, String genre, int numberOfPages)
- Method: toString() [optional]
3. DVD Class (extends LibraryItem):
- Attributes: director (String), duration (int)
- Constructor: DVD(String title, String creator, int itemId, String director, int duration)
- Method: toString() [optional]
4. 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(LibraryItemitem), toString() [optional]
5. Library Class:
- Attributes: items (array of LibraryItem), members (array of LibraryMember)
- Constructor: Library()
- Methods: addItem(LibraryItem item), addMember(LibraryMembermember), toString()
6. Main Class
- Library object
- A menu-driven console interface to:
1. Add items (books or DVDs) to the library.
2. Add members to the library.
3. Allow members to borrow items.
4. Allow members to return items.
5. Display the library's state.
6. Exit the program.
I need help to ensure the user can interact with the library management system through the console interface, using simple arrays for managing items and members.
The 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
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit Enter your choice: 2 Enter name: John Doe Enter address: 123 Main St Enter contact: user email Enter member ID: 1001
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit Enter your choice: 3 Enter member ID: 1001 Enter item ID to borrow: 1 Item checked out successfully.
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit
Enter your choice: 3 Enter member ID: 1001 Enter item ID to borrow: 1 Item is not available for borrowing.
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit Enter your choice: 4 Enter member ID: 1001 Enter item ID to return: 1 Item returned successfully.
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit Enter your choice: 5 Library: Items - 1, Members - 1
1. Add item 2. Add member 3. Borrow item 4. Return item 5. Display library 6. Exit Enter your choice: 6 Exiting...
I would greatly appreciate the help.
Systems Analysis and Design in a Changing World
ISBN: 978-1305117204
7th edition
Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd