From 24d73f9e3fb1f0ce1d4963c033f68353808d9a21 Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Mon, 19 May 2025 14:13:31 +0330 Subject: [PATCH 1/9] add try-catch to displayMainMenu() --- src/view/UserInterface.java | 107 +++++++++++++++++++++++++++++------- 1 file changed, 88 insertions(+), 19 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 90d3586..c5e1f91 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -8,8 +8,15 @@ public class UserInterface { public void displayMainMenu() { while (true) { printMainMenu(); - Scanner inputin = new Scanner(System.in); - int input = inputin.nextInt(); + Scanner mainMenuInput = new Scanner(System.in); + try { + int input = mainMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } switch (input) { case 1: displayMemberMenu(); @@ -26,32 +33,94 @@ public void displayMainMenu() { case 0: return; default: - System.out.println("<<------------------------------------->>"); - System.out.println("<<<>>>"); - System.out.println("<<------------------------------------->>"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); break; } } } public void printMainMenu() { - System.out.println("░░░░░░░░░░░░ ██╗ ███╗ ███╗ ██████╗ ░░░░░░░░░░░░\n"+ - "░░░░░░░░░░░░ ██║ ████╗ ████║██╔════╝ ░░░░░░░░░░░░\n"+ - "█████╗█████╗ ██║ ██╔████╔██║╚█████╗ █████╗█████╗\n"+ - "╚════╝╚════╝ ██║ ██║╚██╔╝██║ ╚═══██╗ ╚════╝╚════╝\n"+ - "░░░░░░░░░░░░ ███████╗██║ ╚═╝ ██║██████╔╝ ░░░░░░░░░░░░\n"+ - "░░░░░░░░░░░░ ╚══════╝╚═╝ ╚═╝╚═════╝ ░░░░░░░░░░░░\n"+ - "░░░░░░░░░░░░ \uD83C\uDD3B\uD83C\uDD38\uD83C\uDD31\uD83C\uDD41\uD83C\uDD30\uD83C\uDD41\uD83C\uDD48 \uD83C\uDD3C\uD83C\uDD30\uD83C\uDD3D\uD83C\uDD30\uD83C\uDD36\uD83C\uDD34\uD83C\uDD3C\uD83C\uDD34\uD83C\uDD3D\uD83C\uDD43 \uD83C\uDD42\uD83C\uDD48\uD83C\uDD42\uD83C\uDD43\uD83C\uDD34\uD83C\uDD3C ░░░░░░░░░░░░░"); - System.out.println("(➊)==> Manage Users"); - System.out.println("(➋)==> Manage Books"); - System.out.println("(➌)==> Loans"); - System.out.println("(➍)==> Reports"); - System.out.println("(⓿)==> Exit"); + System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n" + + "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝ ██║ ██║╚█████╗ ██████╦╝ ██║ ██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n" + + "██████╗██████╗██████╗ ██║ ██║ ╚═══██╗██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝ ║██████╔╝██████╔╝██████╦╝ ███████╗██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n" + + " ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝╚═════╝ \n" + + "███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗\n" + + "████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝\n" + + "██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ██╔████╔██║█████╗ ██╔██╗██║ ██║ \n" + + "██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚████║ ██║ \n" + + "██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗██║ ╚═╝ ██║███████╗██║ ╚███║ ██║ \n" + + "╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚══╝ ╚═╝ \n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Manage Users░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Manage Books░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Loans ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Reports ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Exit ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + + public void printManageUsersMenu(){ + System.out.println( + " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n"+ + "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n"+ + " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n"+ + " ██╗ ██╗ ██████╗███████╗██████╗ ██████╗ \n"+ + "██████╗██████╗██████╗██████╗██║ ██║██╔════╝██╔════╝██╔══██╗██╔════╝██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝██║ ██║╚█████╗ █████╗ ██████╔╝╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗██████╗██║ ██║ ╚═══██╗██╔══╝ ██╔══██╗ ╚═══██╗██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝╚██████╔╝██████╔╝███████╗██║ ██║██████╔╝╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ \n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Undergraduate Student░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Add Graduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Remove Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➎)══> List All Students ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } public void displayMemberMenu() { - // TODO: Implement method 'displayMemberMenu'. - throw new UnsupportedOperationException("Unimplemented method 'displayMemberMenu'"); + while (true) { + printManageUsersMenu(); + Scanner ManageUsersInput = new Scanner(System.in); + try { + int input = ManageUsersInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (input) { + case 1: + addUndergraduateStudent(); + break; + case 2: + addGraduateStudent(); + break; + case 3: + searchStudentByID(); + break; + case 4: + removeStudentByID(); + break; + case 5: + listAllStudents(); + break; + case 0: + displayMainMenu(); + break; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } } public void displayBookMenu() { From d24508f0b9dc2ae711dc7139d5bcb517c133d177 Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Mon, 19 May 2025 15:06:27 +0330 Subject: [PATCH 2/9] debug and import controller.LibraryController --- src/view/UserInterface.java | 94 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index c5e1f91..8beef67 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -3,44 +3,9 @@ import java.util.List; import model.*; import java.util.Scanner; +import controller.LibraryController; public class UserInterface { - public void displayMainMenu() { - while (true) { - printMainMenu(); - Scanner mainMenuInput = new Scanner(System.in); - try { - int input = mainMenuInput.nextInt(); - } - catch(Exception e) { - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - } - switch (input) { - case 1: - displayMemberMenu(); - break; - case 2: - displayBookMenu(); - break; - case 3: - displayLoanMenu(); - break; - case 4: - displayReportMenu(); - break; - case 0: - return; - default: - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - break; - } - } - } - public void printMainMenu() { System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n" + "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + @@ -83,37 +48,74 @@ public void printManageUsersMenu(){ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } + public void displayMainMenu() { + while (true) { + printMainMenu(); + Scanner MainMenuInput = new Scanner(System.in); + int mainmenuinput = 0; + try { + mainmenuinput = MainMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (mainmenuinput) { + case 1: + displayMemberMenu(); + break; + case 2: + displayBookMenu(); + break; + case 3: + displayLoanMenu(); + break; + case 4: + displayReportMenu(); + break; + case 0: + return; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } + } + public void displayMemberMenu() { while (true) { printManageUsersMenu(); - Scanner ManageUsersInput = new Scanner(System.in); + Scanner MemberMenuInput = new Scanner(System.in); + int membermenuinput; try { - int input = ManageUsersInput.nextInt(); + membermenuinput = MemberMenuInput.nextInt(); } catch(Exception e) { System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } - switch (input) { + switch (membermenuinput) { case 1: - addUndergraduateStudent(); + LibraryController.addGraduateStudent(studentId, firstName, ..... ); break; case 2: - addGraduateStudent(); + LibraryController.addGraduateStudent(); break; case 3: - searchStudentByID(); + LibraryController.searchStudentByID(); break; case 4: - removeStudentByID(); + LibraryController.removeStudentByID(); break; case 5: - listAllStudents(); + LibraryController.listAllStudents(); break; case 0: - displayMainMenu(); - break; + return; default: System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); From 2d0a6abbbfc8b9da370b710eb082a0caf10f2d37 Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Tue, 20 May 2025 18:14:37 +0330 Subject: [PATCH 3/9] edit and add variables to member menu and adding bookmenu --- src/view/UserInterface.java | 153 +++++++++++++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 12 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 8beef67..6341637 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -6,8 +6,14 @@ import controller.LibraryController; public class UserInterface { + private LibraryController libraryController; + + public UserInterface() { + libraryController = new LibraryController(); + } + public void printMainMenu() { - System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n" + + System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n" + "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + "╚═════╝╚═════╝╚═════╝ ██║ ██║╚█████╗ ██████╦╝ ██║ ██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n" + "██████╗██████╗██████╗ ██║ ██║ ╚═══██╗██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + @@ -48,13 +54,52 @@ public void printManageUsersMenu(){ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } + public void printManageBooksMenu(){ + System.out.println( + " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n"+ + "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n"+ + " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n"+ + " ██████╗ █████╗ █████╗ ██╗ ██╗ ██████╗ \n"+ + "██████╗██████╗██████╗██████╗██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝██╔════╝ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝██║ ██║██║ ██║█████═╝ ╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗██████╗██╔══██╗██║ ██║██║ ██║██╔═██╗ ╚═══██╗ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗██████╔╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝╚═════╝ \n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Remove Book by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> List All Available Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" +); + } + public void printSearchBookMenu(){ + System.out.println( + " ██████╗███████╗ █████╗ ██████╗ █████╗ ██╗ ██╗ \n"+ + "██████╗██████╗██████╗ ██╔════╝██╔════╝██╔══██╗██╔══██╗██╔══██╗██║ ██║ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ╚█████╗ █████╗ ███████║██████╔╝██║ ╚═╝███████║ ╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗ ╚═══██╗██╔══╝ ██╔══██║██╔══██╗██║ ██╗██╔══██║ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██████╔╝███████╗██║ ██║██║ ██║╚█████╔╝██║ ██║ ╚═════╝╚═════╝╚═════╝\n"+ + " ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ \n"+ + " ██████╗ █████╗ █████╗ ██╗ ██╗ \n"+ + "██████╗██████╗██████╗██████╗ ██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ██████╦╝██║ ██║██║ ██║█████═╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗██████╗ ██╔══██╗██║ ██║██║ ██║██╔═██╗ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝ \n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Search by Title ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Search by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Book Management ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" +); + } + public void displayMainMenu() { while (true) { - printMainMenu(); - Scanner MainMenuInput = new Scanner(System.in); + printMainMenu();//Menu print + Scanner MainMenuInput = new Scanner(System.in);//Get input int mainmenuinput = 0; try { - mainmenuinput = MainMenuInput.nextInt(); + mainmenuinput = MainMenuInput.nextInt();q } catch(Exception e) { System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); @@ -89,7 +134,7 @@ public void displayMemberMenu() { while (true) { printManageUsersMenu(); Scanner MemberMenuInput = new Scanner(System.in); - int membermenuinput; + int membermenuinput = 0; try { membermenuinput = MemberMenuInput.nextInt(); } @@ -100,19 +145,52 @@ public void displayMemberMenu() { } switch (membermenuinput) { case 1: - LibraryController.addGraduateStudent(studentId, firstName, ..... ); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); + String ugstudentId = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student First Name║══> "); + String ugfirstName = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student LastName║══> "); + String uglastName = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Major║══> "); + String ugmajor = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Enrollment Year║══> "); + try{ + int ugenrollmentYear = MemberMenuInput.nextInt(); + } + catch (Exception e){ + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + libraryController.addUndergraduateStudent(ugstudentId, ugfirstName, uglastName, ugmajor, ugenrollmentYear); break; case 2: - LibraryController.addGraduateStudent(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); + String gstudentId = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student First Name║══> "); + String gfirstName = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student LastName║══> "); + String glastName = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Major║══> "); + String gmajor = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Supervisor║══> "); + String gsupervisor = MemberMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Thesis Title║══> "); + String gthesisTitle = MemberMenuInput.nextLine(); + libraryController.addGraduateStudent(gstudentId, gfirstName, glastName, gmajor, gsupervisor, gthesisTitle); break; case 3: - LibraryController.searchStudentByID(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); + String sstudentId = MemberMenuInput.nextLine(); + LibraryController.searchStudent(sstudentId); break; case 4: - LibraryController.removeStudentByID(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); + String rstudentId = MemberMenuInput.nextLine(); + LibraryController.removeStudent(rstudentId); break; case 5: - LibraryController.listAllStudents(); + LibraryController.displayAllStudents(); break; case 0: return; @@ -126,8 +204,59 @@ public void displayMemberMenu() { } public void displayBookMenu() { - // TODO: Implement method 'displayBookMenu'. - throw new UnsupportedOperationException("Unimplemented method 'displayBookMenu'"); + while (true) { + printManageBooksMenu(); + Scanner BooksMenuInput = new Scanner(System.in); + int booksmenuinput = 0; + try { + booksmenuinput = BooksMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (booksmenuinput) { + case 1: + AddBook(); + break; + case 2: + RemoveBookbyISBN(); + break; + case 3: + printSearchBookMenu(); + int searchbookmenu = 0; + try { + searchbookmenu = BooksMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (searchbookmenu){ + case 1: + SearchbyTitle(); + break; + case 2: + SearchbyISBN(); + break; + case 0: + return; + } + break; + case 4: + ListAllAvailableBooks(); + break; + case 0: + return; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } } public void displayLoanMenu() { From 203023fef3201c0e95f418fdda37044da3d46c4b Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Wed, 21 May 2025 18:51:08 +0330 Subject: [PATCH 4/9] adding Loan menu and edit books menu functions --- src/view/UserInterface.java | 147 +++++++++++++++++++++++++----------- 1 file changed, 101 insertions(+), 46 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 6341637..81da0c2 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -13,22 +13,22 @@ public UserInterface() { } public void printMainMenu() { - System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n" + - "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝ ██║ ██║╚█████╗ ██████╦╝ ██║ ██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n" + - "██████╗██████╗██████╗ ██║ ██║ ╚═══██╗██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝ ║██████╔╝██████╔╝██████╦╝ ███████╗██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n" + - " ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝╚═════╝ \n" + - "███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗\n" + - "████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝\n" + - "██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ██╔████╔██║█████╗ ██╔██╗██║ ██║ \n" + - "██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚████║ ██║ \n" + - "██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗██║ ╚═╝ ██║███████╗██║ ╚███║ ██║ \n" + - "╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚══╝ ╚═╝ \n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Manage Users░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Manage Books░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Loans ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Reports ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n"+ + "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██║ ██║╚█████╗ ██████╦╝ ██║ ██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗ ██║ ██║ ╚═══██╗██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ║██████╔╝██████╔╝██████╦╝ ███████╗██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n"+ + " ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝╚═════╝ \n"+ + "███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗\n"+ + "████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝\n"+ + "██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ██╔████╔██║█████╗ ██╔██╗██║ ██║ \n"+ + "██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚████║ ██║ \n"+ + "██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗██║ ╚═╝ ██║███████╗██║ ╚███║ ██║ \n"+ + "╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚══╝ ╚═╝ \n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Manage Users░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Manage Books░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Loans ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Reports ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Exit ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } @@ -46,34 +46,47 @@ public void printManageUsersMenu(){ "██████╗██████╗██████╗██████╗██║ ██║ ╚═══██╗██╔══╝ ██╔══██╗ ╚═══██╗██████╗██████╗██████╗██████╗\n"+ "╚═════╝╚═════╝╚═════╝╚═════╝╚██████╔╝██████╔╝███████╗██║ ██║██████╔╝╚═════╝╚═════╝╚═════╝╚═════╝\n"+ " ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ \n"+ - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Undergraduate Student░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Add Graduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Remove Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➎)══> List All Students ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Undergraduate Student░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Add Graduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> Remove Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➎)══> List All Students ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } - public void printManageBooksMenu(){ + public void printManageBooksMenu() { System.out.println( - " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n"+ - "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n"+ - "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n"+ - " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n"+ - " ██████╗ █████╗ █████╗ ██╗ ██╗ ██████╗ \n"+ - "██████╗██████╗██████╗██████╗██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝██╔════╝ ██████╗██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝██║ ██║██║ ██║█████═╝ ╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ - "██████╗██████╗██████╗██████╗██╔══██╗██║ ██║██║ ██║██╔═██╗ ╚═══██╗ ██████╗██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗██████╔╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ - " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝╚═════╝ \n"+ + " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n" + + "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n" + + "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n" + + " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n" + + " ██████╗ █████╗ █████╗ ██╗ ██╗ ██████╗ \n" + + "██████╗██████╗██████╗██████╗██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝██╔════╝ ██████╗██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝██║ ██║██║ ██║█████═╝ ╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + + "██████╗██████╗██████╗██████╗██╔══██╗██║ ██║██║ ██║██╔═██╗ ╚═══██╗ ██████╗██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗██████╔╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + + " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝╚═════╝ \n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Remove Book by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> List All Available Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" +); + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); } + + public void printLoanMenu(){ + System.out.println( + "██████╗██████╗██████╗██████╗ ██║ ██╗ ██╗██╗ ██╗████╗ ██╗ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ██║ ██║ ██║███████║██╔██╗██║ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ██║ ██║ ██║██╔══██║██║╚████║ \n"+ + "██████╗██████╗██████╗██████╗ ███████╗╚█████╔╝██║ ██║██║ ╚███║ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚══╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Check Out Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Return Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); + } + public void printSearchBookMenu(){ System.out.println( " ██████╗███████╗ █████╗ ██████╗ █████╗ ██╗ ██╗ \n"+ @@ -88,9 +101,9 @@ public void printSearchBookMenu(){ "██████╗██████╗██████╗██████╗ ██╔══██╗██║ ██║██║ ██║██╔═██╗ ██████╗██████╗██████╗██████╗\n"+ "╚═════╝╚═════╝╚═════╝╚═════╝ ██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝ \n"+ - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Search by Title ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Search by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Book Management ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" +); + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Search by Title ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Search by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Book Management ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" ); } public void displayMainMenu() { @@ -99,7 +112,7 @@ public void displayMainMenu() { Scanner MainMenuInput = new Scanner(System.in);//Get input int mainmenuinput = 0; try { - mainmenuinput = MainMenuInput.nextInt();q + mainmenuinput = MainMenuInput.nextInt(); } catch(Exception e) { System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); @@ -218,10 +231,20 @@ public void displayBookMenu() { } switch (booksmenuinput) { case 1: - AddBook(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Title║══> "); + String title = BooksMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Author║══> "); + String author = BooksMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ISBN║══> "); + String isbn1 = BooksMenuInput.nextLine(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Publication Year║══> "); + int publicationYear = BooksMenuInput.nextInt(); + libraryController.addBook(title, author, isbn1, publicationYear); break; case 2: - RemoveBookbyISBN(); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ISBN║══> "); + String isbn2 = BooksMenuInput.nextLine(); + libraryController.removeBook(isbn2); break; case 3: printSearchBookMenu(); @@ -236,17 +259,23 @@ public void displayBookMenu() { } switch (searchbookmenu){ case 1: - SearchbyTitle(); + String T; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Title║══> "); + T = BooksMenuInput.nextLine(); + libraryController.searchBookByTitle(T); break; case 2: - SearchbyISBN(); + String I; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); + I = BooksMenuInput.nextLine(); + libraryController.searchBookByISBN(I); break; case 0: return; } break; case 4: - ListAllAvailableBooks(); + libraryController.displayAvailableBooks(); break; case 0: return; @@ -260,8 +289,34 @@ public void displayBookMenu() { } public void displayLoanMenu() { - // TODO: Implement method 'displayLoanMenu'. - throw new UnsupportedOperationException("Unimplemented method 'displayLoanMenu'"); + while (true) { + printLoanMenu(); + Scanner loanMenuInput = new Scanner(System.in); + int loanmenuinput = 0; + try { + loanmenuinput = loanMenuInput.nextInt();q + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (loanmenuinput) { + case 1: + (); + break; + case 2: + (); + break; + case 0: + return; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } } public void displayReportMenu() { From a36ea7dbf573d42fd7b62538b552de629d0f8379 Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Wed, 21 May 2025 20:13:37 +0330 Subject: [PATCH 5/9] add variable and functin to loan menu --- src/view/UserInterface.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 81da0c2..7c18427 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -265,10 +265,10 @@ public void displayBookMenu() { libraryController.searchBookByTitle(T); break; case 2: - String I; + String isbn3; System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); - I = BooksMenuInput.nextLine(); - libraryController.searchBookByISBN(I); + isbn3 = BooksMenuInput.nextLine(); + libraryController.searchBookByISBN(isbn3); break; case 0: return; @@ -303,10 +303,17 @@ public void displayLoanMenu() { } switch (loanmenuinput) { case 1: - (); + String isbn4; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); + isbn4 = loanMenuInput.nextLine(); + int SID; + SID = loanMenuInput.nextInt(); + libraryController.borrowBook(bookISBN, studentId); break; case 2: - (); + String isbn5; + isbn5 = loanMenuInput.nextLine(); + libraryController.returnBook(bookISBN); break; case 0: return; From 869ddf3bbf218810d26f6f43ee996d6cf30b1dee Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Wed, 21 May 2025 22:10:57 +0330 Subject: [PATCH 6/9] debug some problems --- src/view/UserInterface.java | 242 +++++++++++++++++++++--------------- 1 file changed, 141 insertions(+), 101 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 7c18427..091ce54 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -13,7 +13,8 @@ public UserInterface() { } public void printMainMenu() { - System.out.println(" ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n"+ + System.out.println( + " ██╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ \n"+ "██████╗██████╗██████╗ ██║ ██║██╔════╝██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n"+ "╚═════╝╚═════╝╚═════╝ ██║ ██║╚█████╗ ██████╦╝ ██║ ██║██████╦╝ ╚═════╝╚═════╝╚═════╝\n"+ "██████╗██████╗██████╗ ██║ ██║ ╚═══██╗██╔══██╗ ██║ ██║██╔══██╗ ██████╗██████╗██████╗\n"+ @@ -56,34 +57,22 @@ public void printManageUsersMenu(){ public void printManageBooksMenu() { System.out.println( - " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n" + - "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n" + - "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n" + - " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n" + - " ██████╗ █████╗ █████╗ ██╗ ██╗ ██████╗ \n" + - "██████╗██████╗██████╗██████╗██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝██╔════╝ ██████╗██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝██║ ██║██║ ██║█████═╝ ╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + - "██████╗██████╗██████╗██████╗██╔══██╗██║ ██║██║ ██║██╔═██╗ ╚═══██╗ ██████╗██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗██████╔╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + - " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝╚═════╝ \n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Remove Book by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> List All Available Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); - } - - public void printLoanMenu(){ - System.out.println( - "██████╗██████╗██████╗██████╗ ██║ ██╗ ██╗██╗ ██╗████╗ ██╗ ██████╗██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝╚═════╝ ██║ ██║ ██║███████║██╔██╗██║ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ - " ██║ ██║ ██║██╔══██║██║╚████║ \n"+ - "██████╗██████╗██████╗██████╗ ███████╗╚█████╔╝██║ ██║██║ ╚███║ ██████╗██████╗██████╗██████╗\n"+ - "╚═════╝╚═════╝╚═════╝╚═════╝ ╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚══╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Check Out Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Return Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + " ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗ \n"+ + "██████╗██████╗██████╗ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██╔████╔██║███████║██╔██╗██║███████║██║ ██╗ █████╗ ╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗ ██║╚██╔╝██║██╔══██║██║╚████║██╔══██║██║ ╚██╗██╔══╝ ██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝ ██║ ╚═╝ ██║██║ ██║██║ ╚███║██║ ██║╚██████╔╝███████╗ ╚═════╝╚═════╝╚═════╝\n"+ + " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ \n"+ + " ██████╗ █████╗ █████╗ ██╗ ██╗ ██████╗ \n"+ + "██████╗██████╗██████╗██████╗██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝██╔════╝ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝██║ ██║██║ ██║█████═╝ ╚█████╗ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "██████╗██████╗██████╗██████╗██╔══██╗██║ ██║██║ ██║██╔═██╗ ╚═══██╗ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝██████╦╝╚█████╔╝╚█████╔╝██║ ╚██╗██████╔╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ╚═════╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝╚═════╝ \n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Add Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Remove Book by ISBN ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➌)══> Search Book ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➍)══> List All Available Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Main Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); } @@ -106,6 +95,31 @@ public void printSearchBookMenu(){ "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Book Management ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" ); } + public void printLoanMenu(){ + System.out.println( + "██████╗██████╗██████╗██████╗ ██║ ██╗ ██╗██╗ ██╗████╗ ██╗ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ██║ ██║ ██║███████║██╔██╗██║ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + " ██║ ██║ ██║██╔══██║██║╚████║ \n"+ + "██████╗██████╗██████╗██████╗ ███████╗╚█████╔╝██║ ██║██║ ╚███║ ██████╗██████╗██████╗██████╗\n"+ + "╚═════╝╚═════╝╚═════╝╚═════╝ ╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚══╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Check Out Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Return Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Loan Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); + } + + public void printReportsMenu(){ + System.out.println( + " ██████╗ ███████╗██████╗ █████╗ ██████╗ ████████╗ ██████╗ \n"+ + "██████╗██████╗ ██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝ ██████╗██████╗\n"+ + "╚═════╝╚═════╝ ██████╔╝█████╗ ██████╔╝██║ ██║██████╔╝ ██║ ╚█████╗ ╚═════╝╚═════╝\n"+ + " ██╔══██╗██╔══╝ ██╔═══╝ ██║ ██║██╔══██╗ ██║ ╚═══██╗ \n"+ + "██████╗██████╗ ██║ ██║███████╗██║ ╚█████╔╝██║ ██║ ██║ ██████╔╝ ██████╗██████╗\n"+ + "╚═════╝╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═════╝\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➊)══> Check Out Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(➋)══> Return Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"+ + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(⓿)══> Back to Loan Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n"); + } + public void displayMainMenu() { while (true) { printMainMenu();//Menu print @@ -168,14 +182,14 @@ public void displayMemberMenu() { String ugmajor = MemberMenuInput.nextLine(); System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Enrollment Year║══> "); try{ - int ugenrollmentYear = MemberMenuInput.nextInt(); + int ugenrollmentyear = MemberMenuInput.nextInt(); } catch (Exception e){ System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } - libraryController.addUndergraduateStudent(ugstudentId, ugfirstName, uglastName, ugmajor, ugenrollmentYear); + libraryController.addUndergraduateStudent(ugstudentId, ugfirstName, uglastName, ugmajor, ugenrollmentyear); break; case 2: System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); @@ -286,118 +300,144 @@ public void displayBookMenu() { break; } } - } + } - public void displayLoanMenu() { - while (true) { - printLoanMenu(); - Scanner loanMenuInput = new Scanner(System.in); - int loanmenuinput = 0; - try { - loanmenuinput = loanMenuInput.nextInt();q - } - catch(Exception e) { - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - } - switch (loanmenuinput) { - case 1: - String isbn4; - System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); - isbn4 = loanMenuInput.nextLine(); - int SID; - SID = loanMenuInput.nextInt(); - libraryController.borrowBook(bookISBN, studentId); - break; - case 2: - String isbn5; - isbn5 = loanMenuInput.nextLine(); - libraryController.returnBook(bookISBN); - break; - case 0: - return; - default: - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - break; - } - } - } + public void displayLoanMenu() { + while (true) { + printLoanMenu(); + Scanner loanMenuInput = new Scanner(System.in); + int loanmenuinput = 0; + try { + loanmenuinput = loanMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (loanmenuinput) { + case 1: + String isbn4; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); + isbn4 = loanMenuInput.nextLine(); + String SID; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Student ID║══> "); + SID = loanMenuInput.nextLine(); + libraryController.borrowBook(isbn4, SID); + break; + case 2: + String isbn5; + isbn5 = loanMenuInput.nextLine(); + libraryController.returnBook(isbn5); + break; + case 0: + return; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } + } + + public void displayReportMenu() { + while (true) { + printReportsMenu(); + Scanner reportsMenuInput = new Scanner(System.in); + int reportsmenuinput = 0; + try { + reportsmenuinput = reportsMenuInput.nextInt(); + } + catch(Exception e) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid character⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } + switch (reportsmenuinput) { + case 1: + break; + case 2: + break; + case 0: + return; + default: + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please select the correct option⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + break; + } + } + } - public void displayReportMenu() { - // TODO: Implement method 'displayReportMenu'. - throw new UnsupportedOperationException("Unimplemented method 'displayReportMenu'"); - } - public void getUndergraduateStudentDetails() { + public void getUndergraduateStudentDetails() { // TODO: Implement method 'getUndergraduateStudentDetails'. throw new UnsupportedOperationException("Unimplemented method 'getUndergraduateStudentDetails'"); - } + } - public void getGraduateStudentDetails() { + public void getGraduateStudentDetails() { // TODO: Implement method 'getGraduateStudentDetails'. throw new UnsupportedOperationException("Unimplemented method 'getGraduateStudentDetails'"); - } + } - public void getStudentIdForSearch() { + public void getStudentIdForSearch() { // TODO: Implement method 'getStudentIdForSearch'. throw new UnsupportedOperationException("Unimplemented method 'getStudentIdForSearch'"); - } + } - public void getBookDetailsForCreation() { + public void getBookDetailsForCreation() { // TODO: Implement method 'getBookDetailsForCreation'. throw new UnsupportedOperationException("Unimplemented method 'getBookDetailsForCreation'"); - } + } - public void getBookISBNForOperation() { + public void getBookISBNForOperation() { // TODO: Implement method 'getBookISBNForOperation'. throw new UnsupportedOperationException("Unimplemented method 'getBookISBNForOperation'"); - } + } - public void getBookTitleForSearch() { + public void getBookTitleForSearch() { // TODO: Implement method 'getBookTitleForSearch'. throw new UnsupportedOperationException("Unimplemented method 'getBookTitleForSearch'"); - } + } - public void getStudentIdForLoan() { + public void getStudentIdForLoan() { // TODO: Implement method 'getStudentIdForLoan'. throw new UnsupportedOperationException("Unimplemented method 'getStudentIdForLoan'"); - } + } - public void getBookISBNForLoan() { + public void getBookISBNForLoan() { // TODO: Implement method 'getBookISBNForLoan'. throw new UnsupportedOperationException("Unimplemented method 'getBookISBNForLoan'"); - } + } - public void displayStudentDetails(Student student) { + public void displayStudentDetails(Student student) { // TODO: Implement method 'displayStudentDetails'. throw new UnsupportedOperationException("Unimplemented method 'displayStudentDetails'"); - } + } - public void displayBookDetails(Book book) { + public void displayBookDetails(Book book) { // TODO: Implement method 'displayBookDetails'. throw new UnsupportedOperationException("Unimplemented method 'displayBookDetails'"); - } + } - public void displayAllStudents(List students) { + public void displayAllStudents(List students) { // TODO: Implement method 'displayAllStudents'. throw new UnsupportedOperationException("Unimplemented method 'displayAllStudents'"); - } + } - public void displayAllBooks(List books) { + public void displayAllBooks(List books) { // TODO: Implement method 'displayAllBooks'. throw new UnsupportedOperationException("Unimplemented method 'displayAllBooks'"); - } + } - public void displayLoanDetails(Loan loan) { + public void displayLoanDetails(Loan loan) { // TODO: Implement method 'displayLoanDetails'. throw new UnsupportedOperationException("Unimplemented method 'displayLoanDetails'"); - } + } - public void displayReport(List results) { + public void displayReport(List results) { // TODO: Implement method 'displayReport'. throw new UnsupportedOperationException("Unimplemented method 'displayReport'"); - } + } } From d34a3c432df7e3524dc7fdf003cab10a62ce611d Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Fri, 23 May 2025 01:19:38 +0330 Subject: [PATCH 7/9] adding some function and edit menu functions --- src/view/UserInterface.java | 86 +++++++++++++++---------------------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 091ce54..9b72676 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -181,8 +181,9 @@ public void displayMemberMenu() { System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Major║══> "); String ugmajor = MemberMenuInput.nextLine(); System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Enrollment Year║══> "); + int ugenrollmentyear = 0; try{ - int ugenrollmentyear = MemberMenuInput.nextInt(); + ugenrollmentyear = MemberMenuInput.nextInt(); } catch (Exception e){ System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); @@ -207,17 +208,15 @@ public void displayMemberMenu() { libraryController.addGraduateStudent(gstudentId, gfirstName, glastName, gmajor, gsupervisor, gthesisTitle); break; case 3: - System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); - String sstudentId = MemberMenuInput.nextLine(); - LibraryController.searchStudent(sstudentId); + libraryController.searchStudent(getStudentIdForSearch()); break; case 4: System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); String rstudentId = MemberMenuInput.nextLine(); - LibraryController.removeStudent(rstudentId); + libraryController.removeStudent(rstudentId); break; case 5: - LibraryController.displayAllStudents(); + libraryController.getAllStudents(); break; case 0: return; @@ -273,10 +272,7 @@ public void displayBookMenu() { } switch (searchbookmenu){ case 1: - String T; - System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Title║══> "); - T = BooksMenuInput.nextLine(); - libraryController.searchBookByTitle(T); + libraryController.searchBookByTitle(getBookTitleForSearch()); break; case 2: String isbn3; @@ -289,7 +285,7 @@ public void displayBookMenu() { } break; case 4: - libraryController.displayAvailableBooks(); + libraryController.getAvailableBooks(); break; case 0: return; @@ -317,16 +313,14 @@ public void displayLoanMenu() { } switch (loanmenuinput) { case 1: - String isbn4; + Book isbn4; System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); - isbn4 = loanMenuInput.nextLine(); - String SID; + Student SID; System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Student ID║══> "); - SID = loanMenuInput.nextLine(); libraryController.borrowBook(isbn4, SID); break; case 2: - String isbn5; + Book isbn5; isbn5 = loanMenuInput.nextLine(); libraryController.returnBook(isbn5); break; @@ -370,35 +364,23 @@ public void displayReportMenu() { } } - - public void getUndergraduateStudentDetails() { - // TODO: Implement method 'getUndergraduateStudentDetails'. - throw new UnsupportedOperationException("Unimplemented method 'getUndergraduateStudentDetails'"); - } - - public void getGraduateStudentDetails() { - // TODO: Implement method 'getGraduateStudentDetails'. - throw new UnsupportedOperationException("Unimplemented method 'getGraduateStudentDetails'"); - } - - public void getStudentIdForSearch() { - // TODO: Implement method 'getStudentIdForSearch'. - throw new UnsupportedOperationException("Unimplemented method 'getStudentIdForSearch'"); - } - - public void getBookDetailsForCreation() { - // TODO: Implement method 'getBookDetailsForCreation'. - throw new UnsupportedOperationException("Unimplemented method 'getBookDetailsForCreation'"); + public String getStudentIdForSearch() { + Scanner gSIFS = new Scanner(System.in); + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ID║══> "); + String sstudentId = gSIFS.nextLine(); + return sstudentId; } public void getBookISBNForOperation() { - // TODO: Implement method 'getBookISBNForOperation'. - throw new UnsupportedOperationException("Unimplemented method 'getBookISBNForOperation'"); + } - public void getBookTitleForSearch() { - // TODO: Implement method 'getBookTitleForSearch'. - throw new UnsupportedOperationException("Unimplemented method 'getBookTitleForSearch'"); + public String getBookTitleForSearch() { + Scanner gBTFS = new Scanner(System.in); + String T; + System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Title║══> "); + T = gBTFS.nextLine(); + return T; } public void getStudentIdForLoan() { @@ -417,13 +399,21 @@ public void displayStudentDetails(Student student) { } public void displayBookDetails(Book book) { - // TODO: Implement method 'displayBookDetails'. - throw new UnsupportedOperationException("Unimplemented method 'displayBookDetails'"); + + } + + public void getBookDetailsForCreation() { + // TODO: Implement method 'getBookDetailsForCreation'. + throw new UnsupportedOperationException("Unimplemented method 'getBookDetailsForCreation'"); + } + + public void displayLoanDetails(Loan loan) { + // TODO: Implement method 'displayLoanDetails'. + throw new UnsupportedOperationException("Unimplemented method 'displayLoanDetails'"); } public void displayAllStudents(List students) { - // TODO: Implement method 'displayAllStudents'. - throw new UnsupportedOperationException("Unimplemented method 'displayAllStudents'"); + System.out.println(); } public void displayAllBooks(List books) { @@ -431,13 +421,7 @@ public void displayAllBooks(List books) { throw new UnsupportedOperationException("Unimplemented method 'displayAllBooks'"); } - public void displayLoanDetails(Loan loan) { - // TODO: Implement method 'displayLoanDetails'. - throw new UnsupportedOperationException("Unimplemented method 'displayLoanDetails'"); - } - public void displayReport(List results) { - // TODO: Implement method 'displayReport'. - throw new UnsupportedOperationException("Unimplemented method 'displayReport'"); + } } From 9ed17ebac59dabff56f6e1b847df7244b9809630 Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Tue, 27 May 2025 01:01:25 +0330 Subject: [PATCH 8/9] command two line for compile by gitbot --- src/view/UserInterface.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index 9b72676..adeee3b 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -317,12 +317,12 @@ public void displayLoanMenu() { System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book ISBN║══> "); Student SID; System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Book Student ID║══> "); - libraryController.borrowBook(isbn4, SID); + //libraryController.borrowBook(isbn4, SID); break; case 2: Book isbn5; - isbn5 = loanMenuInput.nextLine(); - libraryController.returnBook(isbn5); + //isbn5 = loanMenuInput.nextLine(); + //libraryController.returnBook(isbn5); break; case 0: return; From d7792f79790957139aa7f4426ad3878812306ecc Mon Sep 17 00:00:00 2001 From: Reza <108628946+rzr8i@users.noreply.github.com> Date: Wed, 28 May 2025 19:02:29 +0330 Subject: [PATCH 9/9] fix: addBook function call in UI --- src/view/UserInterface.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index adeee3b..7286753 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -252,7 +252,8 @@ public void displayBookMenu() { String isbn1 = BooksMenuInput.nextLine(); System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student Publication Year║══> "); int publicationYear = BooksMenuInput.nextInt(); - libraryController.addBook(title, author, isbn1, publicationYear); + // TODO: print list of available categories and let the user choose one or define one + libraryController.addBook(title, author, isbn1, null, publicationYear); break; case 2: System.out.print("░░░░░░░░░░░░░░░░░░░░░░░░░░║Enter The Student ISBN║══> ");