$35
s part of your third assignment, you are required to alter the code from your previous work (Assignment 2) and enhance it using Collections.
You were asked to use arrays in your previous assignments to hold library related information. In this assignment you are required to change all existing arrays into an ArrayList to accommodate dynamically growing size of library data, which can be achieved using Collections.
For searching purposes, you should be using Iterator class and their corresponding methods to traverse within the data structures.
Accordingly, when the application is executed, it should prompt the user the following updated menu:
1. Add a new book
2. Add a new Online Article
3. Create a member account
4. Select User to Process
5. Check out (previously reserved) a book
6. Return a book
7. Add access to a new online article
8. End an online article access
9. Display all accounts
10. Exit.
Accordingly, if the user presses on the 4th menu item, the application should ask for an id and search it within the member arraylist. If the member with the given id exists then it should store it in a placeholder variable, if not, it should give an error message.
On the other hand, if the user presses on the 6th menu item, the application should ask for the ISBN of the book that is being returned to the library. The book with the given ISBN should be removed from the checkout list of the selected user - set as part of menu item 4.
In order to achieve this, you should add a method named returnBook(String ISBN) to your Member classes. With the help of Iterator class, this method will iterate through the Book ArrayList of the member and remove the corresponding book.
Similarly, if the user chooses the 8th option, your application should ask for the DOI number of the online article that will be removed from the member’s quota. The online article with the given DOI number should be removed from the online article checkout list of the selected user - set as part of menu item 4. In order to achieve this, you should add a method named returnOA(String DOI) to your Member classes. Accordingly, utilizing the Iterator class, this method will iterate through the OnlineArticle ArrayList of the selected member and remove the corresponding online article from the list.
There is also a slight change in the flow of the application, previously you have been asked to initialize the Date class as part of the first menu item - Add new book. However, with the updated flow, you are required to create and set the Date object as part of Checkout step
(menu item 5) so you can keep track of the book’s check out date.
Application Walkthrough
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
1
Enter book name:
Java: How to Program
Enter writer name:
Deitel
Enter ISBN:
1111-2222
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
1
Enter book name:
Java in a Nutshell: A Desktop Quick Reference
Enter writer name:
Flanagan
Enter ISBN:
3333-4444
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
3
1.Create a regular member account
2.Create a student member account
3.Create an academic member account
2
Enter your name: Thomas Anderson
Enter your ID:
1
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
4
Enter an ID to select:
1
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
5
Search for a Book with ISBN:
1111-2222
Check out Date:
Enter day:
03
Enter month:
11
Enter year:
2021
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
5
Search for a Book with ISBN:
3333-4444
Check out Date:
Enter day:
03
Enter month:
11
Enter year:
2021
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
9 Reader ID:1
Books reserved:
1111-2222: Java: How to Program
3333-4444: Java in a Nutshell: A Desktop Quick Reference Articles accessed:
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
6
Enter the ISBN of the book you want to return:
1111-2222
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
9 Reader ID:1
Books reserved:
3333-4444: Java in a Nutshell: A Desktop Quick Reference Articles accessed:
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
2
Enter article name:
Java programming for high-performance numerical computing
Enter writer name:
Moreira
Enter DOI:
10.1147/sj.391.0021
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
7
Search for an article with DOI:
10.1147/sj.391.0021
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
9 Reader ID:1
Books reserved:
3333-4444: Java in a Nutshell: A Desktop Quick Reference
Articles accessed:
10.1147/sj.391.0021: Java programming for high-performance numerical computing
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
8
Enter the DOI of the online article to end the access:
10.1147/sj.391.0021
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
9 Reader ID:1
Books reserved:
3333-4444: Java in a Nutshell: A Desktop Quick Reference Articles accessed:
1.Add a new book
2.Add a new Online Article
3.Create a member account
4.Select User to Process
5.Check out a book
6.Return a book
7.Add access to a new online article
8.End an online article access
9.Display all accounts
10.Exit.
10