Question: Modify The Code: 1.Add Teachers Menu as like Student menu and all the option is same 2.Add a file class which can record all the
Modify The Code:
1.Add Teachers Menu as like Student menu and all the option is same
2.Add a file class which can record all the input value like id, name, password , book name , and others in a file
Note Programing Language: Java





Sorry for image code, I unable to upload word file
import java.util.*; public class Driver_Class { // driver function public static void main(String[] args) { // to allow for user inputs Scanner keyboard = new Scanner(System.in); // default password for admin access String adminPassword = "admin"; // to store student's roll number String rollNumber; // library to store all the info Library library = new Library(100); while (true) ( // print the general menu String generalChoice = generalMenu(); if (generalchoice.equals("#")) { // admin-mode System.out.print(" (admin) - Enter Password: "); String password = keyboard.next(); if (password.equals(adminPassword)) { while (true) { // prints admin menu String ch = adminMenu(); // write logical statements to work on it if (ch.equals("1")) { // add book System.out.print("Name of the book: "); String bookName = keyboard.next(); System.out.print("Count of the book: "); int bookCount = keyboard.nextInt(); library.addBooks (new Book (bookName, bookCount)); } else if (ch.equals("8")) { break; } } else { System.out.println("Wrong Password"); } } else if (generalchoice.equals("")) { while (true){ // student-mode System.out.print("(student) - Enter roll no.: "); rollNumber = keyboard.next(); // print the student menu String ch = studentMenu(); if (ch.equals("1")) { // search book System.out.print("Name of the book: "); String bookName - keyboard.next(); library.searchBook (bookName); } else if (ch.equals("S")) { break; } } } else { // exit return; } } public static String generalMenu() { // to allow for user inputs Scanner keyboard = new Scanner(System.in); System.out.println("********Library Management System************"); System.out.println("Enter #: Switch to Admin Mode"); System.out.println("Enter $: Switch to Student Mode"); System.out.println("Enter <: exit system.out.print>>"); String choice = keyboard.next(); return choice; } public static String adminMenu() { // to allow for user inputs Scanner keyboard = new Scanner(System.in); System.out.println("********(Admin)-Library Management System************"); System.out.println("Press 1: Add book."); System.out.println("Press 2: Modify book record."); System.out.println("Press 3: Delete a book."); System.out.println("Press 4: Issue a book."); System.out.println("Press 5: View all availaible book."); System.out.println("Press 6: View Records in particular month."); System.out.println("Press 7: Change Password."); System.out.println("Press 8: Go back to general menu."); System.out.print(">>"); String choice = keyboard.next(); return choice; } public static String studentMenu() { // to allow for user inputs Scanner keyboard = new Scanner(System.in); System.out.println("********(Student)- Library Management System************"); System.out.println("Press 1: search book."); System.out.println("Press 2: Read a book."); System.out.println("Press 3: Return a book."); System.out.println("Press 4: Borrow a book."); System.out.println("Press 5: Go back to general menu."); System.out.print(">>"); String ch - keyboard.next(); return ch; }; public class Library { // stores books private Book stock[]; // points to the current book in the stock private int counter; // maximum number of books that can be stored in the library private int maxSize; // default constructor public Library() { // create an array of Book of default size 100 stock - new Book [180]; counter = 0; maxSize = 100; } public Library(int size) { stock = new Book[size]; counter = 0; maxSize = size; } // add books to the stock if it isn't full public void addBooks (Book b) { if (counter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
