From c239d5087b78b63f2bdee4f87b34fe509e73cd9d Mon Sep 17 00:00:00 2001 From: alimohammadzadeali Date: Fri, 30 May 2025 15:40:25 +0330 Subject: [PATCH] editing error massages and fix some problems --- src/view/UserInterface.java | 80 +++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/src/view/UserInterface.java b/src/view/UserInterface.java index c092bf6..0c63fce 100644 --- a/src/view/UserInterface.java +++ b/src/view/UserInterface.java @@ -50,7 +50,7 @@ public void printManageUsersMenu() { "██████╗██████╗██████╗██████╗██║ ██║ ╚═══██╗██╔══╝ ██╔══██╗ ╚═══██╗██████╗██████╗██████╗██████╗\n" + "╚═════╝╚═════╝╚═════╝╚═════╝╚██████╔╝██████╔╝███████╗██║ ██║██████╔╝╚═════╝╚═════╝╚═════╝╚═════╝\n" + " ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ \n" + - "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(1)══> Add Undergraduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(1)══> Add Undergraduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(2)══> Add Graduate Student ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(3)══> Search Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(4)══> Remove Student by ID ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + @@ -103,11 +103,12 @@ public void printSearchBookMenu() { public void printLoanMenu() { System.out.println( + " ██╗ █████╗ █████╗ ███╗ ██╗ \n"+ "██████╗██████╗██████╗██████╗ ██║ ██╗ ██╗██╗ ██╗████╗ ██╗ ██████╗██████╗██████╗██████╗\n" + "╚═════╝╚═════╝╚═════╝╚═════╝ ██║ ██║ ██║███████║██╔██╗██║ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + - " ██║ ██║ ██║██╔══██║██║╚████║ \n" + - "██████╗██████╗██████╗██████╗ ███████╗╚█████╔╝██║ ██║██║ ╚███║ ██████╗██████╗██████╗██████╗\n" + - "╚═════╝╚═════╝╚═════╝╚═════╝ ╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚══╝ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + + "██████╗██████╗██████╗██████╗ ██║ ██║ ██║██╔══██║██║╚████║ ██████╗██████╗██████╗██████╗\n" + + "╚═════╝╚═════╝╚═════╝╚═════╝ ███████╗╚█████╔╝██║ ██║██║ ╚███║ ╚═════╝╚═════╝╚═════╝╚═════╝\n" + + " ╚══════╝ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚══╝ \n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(1)══> Check Out Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(2)══> Return Books ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░(0)══> Back to Loan Menu ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░\n" + @@ -181,8 +182,11 @@ public void displayMemberMenu() { } case 3: { Student student = libraryController.searchStudent(readString("Enter Student ID")); - if (student == null) - System.out.println("Student not found!"); + if (student == null) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Student not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } else System.out.println(student); break; @@ -243,8 +247,11 @@ public void displaySearchBookMenu() { switch (choice) { case 1: { Book book = libraryController.searchBookByTitle(readString("Enter Book Title")); - if (book == null) - System.out.println("Book not found!"); + if (book == null){ + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Book not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } else System.out.println(book); break; @@ -252,8 +259,11 @@ public void displaySearchBookMenu() { case 2: { String isbn = readString("Enter the book ISBN"); Book book = libraryController.searchBookByISBN(isbn); - if (book == null) - System.out.println("Book not found!"); + if (book == null) { + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Book not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + } else System.out.println(book); break; @@ -273,12 +283,16 @@ public void displayLoanMenu() { String studentID = readString("Enter you Student ID"); Student student = libraryController.searchStudent(studentID); if (student == null) { - System.out.println("Student not found!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Student not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } List availableBooks = libraryController.getAvailableBooks(); if (availableBooks == null || availableBooks.size() == 0) { - System.out.println("No books available right now!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ No books available right now! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } @@ -289,12 +303,16 @@ public void displayLoanMenu() { case 2: { String studentID = readString("Enter your Student ID"); if (libraryController.searchStudent(studentID) == null) { - System.out.println("Student not found!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Student not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } List books = libraryController.getBorrowedBooksByStudent(studentID); if (books == null || books.size() == 0) { - System.out.println("You haven't borrowed any book!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ You haven't borrowed any book! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } Book selectedBook = readSelection("Which book do you want to return?", books); @@ -317,13 +335,17 @@ public void displayReportMenu() { case 1: { List categories = libraryController.getCategories(); if (categories == null || categories.size() == 0) { - System.out.println("No categories available right now!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░<<<⚠ No categories available right now! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } Category category = readSelection("Choose a category", categories); List books = libraryController.getBooksByCategory(category); if (books == null || books.size() == 0) { - System.out.println("No books available in this category"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░<<<⚠ No books available in this category ⚠>>>░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } displayReport(books); @@ -332,12 +354,16 @@ public void displayReportMenu() { case 2: { String studentID = readString("Enter your Student ID"); if (libraryController.searchStudent(studentID) == null) { - System.out.println("Student not found!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Student not found! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } List books = libraryController.getBorrowedBooksByStudent(studentID); if (books == null || books.size() == 0) { - System.out.println("You haven't borrowed any book!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ You haven't borrowed any book! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } displayReport(books); @@ -347,10 +373,11 @@ public void displayReportMenu() { String major = readString("Enter a major"); List students = libraryController.getStudentsByMajor(major); if (students == null || students.size() == 0) { - System.out.println("No students found in this major"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ No students found in this major! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); continue; } - displayReport(students); break; } @@ -386,7 +413,7 @@ private void printPrompt(String prompt) { private void printInvalidInput() { System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); - System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠⃨Please enter valid characters⚠⃨>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ Please enter valid characters ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░"); System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); } @@ -425,16 +452,19 @@ private Category createNewCategory() { String name = readString("Enter Category Name"); String description = readString("Enter Category Description"); libraryController.addCategory(name, description); - System.out.println("New category created successfully!"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░<<<✅New category created successfully!✅>>>░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); return readCategorySelection(libraryController.getCategories()); } private Category readCategorySelection(List categories) { if (categories == null || categories.size() == 0) { - System.out.println("No categories available"); - System.out.println("Creating a new category..."); - + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<⚠ No categories available! ⚠>>>░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░<<<✔ Creating a new category... ✔>>>░░░░░░░░░░░░░░░░░░░░░░░░░░"); + System.out.println("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); return createNewCategory(); }