public void showPublicationMenuItems() { Utility.setMessage("Please enter a choice:"); System.out.println( "1: Books\t2: Journals\t3: Conferences Papers\t0: Go back to previous menu."); boolean flag = true; try { while (flag) { int choice = Integer.parseInt(Utility.enteredConsoleString()); switch (choice) { case 0: searchResources(); flag = false; break; case 1: System.out.println("Books"); // Call check out method Book book = new Book(this.userName, this.userType); book.showBooks(); flag = false; break; case 2: System.out.println("Journals"); Journal journal = new Journal(this.userName, this.userType); journal.showJournals(); flag = false; break; case 3: System.out.println("Conference Papers"); // Call check out method ConferencePaper confPaper = new ConferencePaper(this.userName, this.userType); confPaper.searchConferencePapers(); flag = false; break; default: System.out.println("Invalid choice: Please enter again."); showPublicationMenuItems(); flag = false; break; } } } catch (Exception e) { Utility.badErrorMessage(); searchResources(); } }
public void searchResources() { System.out.println("Please enter your choice:"); System.out.println( "1: Publications\t\t2: Conference/Study rooms\t3: Cameras\t0: Go back to previous menu."); boolean flag = true; try { while (flag) { int choice = Integer.parseInt(Utility.enteredConsoleString()); switch (choice) { case 0: Utility.callUserDialogueBox(userName, userType); flag = false; break; case 1: System.out.println("Publications"); // Call check out method showPublicationMenuItems(); flag = false; break; case 2: Room room = new Room(userName, userType); room.showDialogueBox(); flag = false; break; case 3: // Call check out method Camera camera = new Camera(this.userName, this.userType); camera.searchCameras(); flag = false; break; default: System.out.println("Invalid choice: Please enter again."); searchResources(); flag = false; break; } } } catch (Exception e) { Utility.badErrorMessage(); searchResources(); } }