I have an assignment to create a linkedlist in java its like a school library I
ID: 3689365 • Letter: I
Question
I have an assignment to create a linkedlist in java its like a school library I have to add books and users, and I have to create a function to update the users or book informations so the admin can edit their info if there is a mistake! I need help in the code please.
This is the project I did all of the things but I don't understand how to do the update function
Description:
PMU facilitates a catalog of books for its faculty and students. Several books are available for the students and faculty members.
Catalog has a pool of books of different authors.
The faculty members and students can access two books at a time depending on the availability.
Each book has a unique code.
You should provide functions to support the following operations:
The book administrator can add new books and its information.
The book administrator can remove and update the information of the faculty or student who borrowed the books.
The faculty and students can inquire about the specific books including the author information.
The faculty and students can request for a new book.
The book administrator can update the requests or new requirements from the faculty or the students.
The faculty and the students can raise a complain about the non-availability of the books or any other.
The book administrator can generate the reports of the book based on:
Book title
Book Author
Book ISBN
The system should be able to handle other kinds of reports to be generated in the future.
You should create three classes, one for Book, the second for Administrator and the third for Users. Use the linked list and the files for database.
Project Output Screen:
When I run the project, it should look like the following:
Please select the user:
Administrator
User
After selecting administrator, the following menu should be displayed:
Add new books and its information.
Add the information of the user who borrowed the book
Delete the information of the faculty or student who borrowed the books.
Update the requests or new requirements from the faculty or the students.
Generate the reports of the book based on:
Book title
Book Author
Book ISBN
After selecting user, the following menu should be displayed:
Inquire about the specific books including the author information.
Request for a new book
Complain if any
Now, after I see the above menu, I will make a selection. Based on my selection, your program should call some function to carry out the operation needed for that selected task.
After that operation is performed, you should show me the above mentioned selection menu again. This should continue in an infinite loop until I want to exit the program.
Explanation / Answer
// Look at the following code and observe your requirements(updation of books etc) // check the code properly while copying to your ide package library; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Scanner; public class Book { public String title; public String author; public String publisher; public String publicationYear; public String status; public String borrower; public String borrowDate; public String returnDate; public String status1 = "Available"; public String status2 = "Borrowed"; public int BookChoice; static ArrayList UserList = new ArrayList(); static ArrayList BookList = new ArrayList(); static int choice ; static Scanner userInput = new Scanner(System.in); static Scanner choiceInput = new Scanner(System.in); /* * Book Constructor: */ /** * * Class Methods here: * */ public static void displayFirstMenu(){ System.out.println("> Choose one of the options below by typing the corresponding number: "); System.out.println("2- Add a book to the Library."); System.out.println("6- Blow up library."); System.out.println("7- Back to main menu."); System.out.println("0- Exit."); System.out.println("> Enter your option here: "); choice = choiceInput.nextInt();//User inputs a choice (integer). } public static void displaySecondMenu(){ System.out.println("> Choose one of the options below by typing the corresponding number: "); System.out.println("1- Check library list."); System.out.println("2- Add a book to the Library."); System.out.println("3- Borrow a book."); System.out.println("4- Return a book."); System.out.println("5- Delete a book."); System.out.println("6- Blow up library."); System.out.println("7- Back to main menu."); System.out.println("0- Exit."); System.out.println("> Enter your option here: "); choice = choiceInput.nextInt();//User inputs a choice (integer). } public String displayBook(){ String BookInfo = "----------------------------"+ " Title:.................."+title+ " Author:................."+author+ " Publisher:.............."+publisher+ " PublicationYear:........"+publicationYear+ " Status:................."+status+ " Borrower:..............."+borrower+ " Date Borrowed:.........."+borrowDate+ " Return date:............"+returnDate+ " ----------------------------"; return BookInfo; } public void createBook(){ System.out.println("> Enter the title of the book: "); title = userInput.nextLine(); System.out.println("> Enter the author of the book: "); author = userInput.nextLine(); System.out.println("> Enter the publisher of the book: "); publisher = userInput.nextLine(); System.out.println("> Enter the publication year of the book: "); publicationYear = userInput.nextLine(); borrower = "nobody"; borrowDate = "none"; returnDate = "none"; status = "Available"; } public void addBook(){ Book newBook = new Book(); //create new book object with status "Available." newBook.createBook(); BookList.add(newBook);//add the book to the BookList ArrayList. System.out.println("---------------------------------------------------------"); System.out.println("> You have successfully added the book to the library! "); } public void displayBookList(){ if (BookList.size() == 0){//If the library is empty, it goes back to main menu and choice. System.out.println("> There Library is Emply! Please add a book first! "); Book.displayFirstMenu();//Display to main menu. choice = choiceInput.nextInt();//Register new choice. } else { for (int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.