From b45e4b612bc0523f29b91a52d5c955b7381ecf7a Mon Sep 17 00:00:00 2001 From: yekta Date: Tue, 30 Apr 2024 14:48:48 +0330 Subject: [PATCH 01/10] Book class is made --- Answers/src/main/java/Book.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Answers/src/main/java/Book.java diff --git a/Answers/src/main/java/Book.java b/Answers/src/main/java/Book.java new file mode 100644 index 0000000..fec7c9e --- /dev/null +++ b/Answers/src/main/java/Book.java @@ -0,0 +1,16 @@ +public class Book { + private int bookId; + private String Title; + private String Author; + private boolean Availability_status; + private String Description; + + public Book(int bookId , String Title , String Author , boolean Availability_status, String Description){ + this.bookId = bookId; + this.Author = Author; + this.Title = Title; + this.Availability_status = Availability_status; + this.Description = Description; + + } +} From 02eb6772c08a1b4fef840a7519da4147e4d52a09 Mon Sep 17 00:00:00 2001 From: yekta Date: Tue, 30 Apr 2024 15:01:33 +0330 Subject: [PATCH 02/10] Class user made --- Answers/src/main/java/User.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Answers/src/main/java/User.java diff --git a/Answers/src/main/java/User.java b/Answers/src/main/java/User.java new file mode 100644 index 0000000..0d431aa --- /dev/null +++ b/Answers/src/main/java/User.java @@ -0,0 +1,11 @@ +public class User { + String Name; + int Unique_ID; + int Phone_number; + + public User(String Name , int Unique_ID , int Phone_number){ + this.Name = Name; + this.Unique_ID = Unique_ID; + this.Phone_number = Phone_number; + } +} From e26564e973d7ea11fcbc064f1496d20cb0fb2013 Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:26:55 +0330 Subject: [PATCH 03/10] class admin added --- Answers/src/main/java/Admin.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Answers/src/main/java/Admin.java diff --git a/Answers/src/main/java/Admin.java b/Answers/src/main/java/Admin.java new file mode 100644 index 0000000..4e12806 --- /dev/null +++ b/Answers/src/main/java/Admin.java @@ -0,0 +1,16 @@ +public class Admin extends User{ + private String password; + public Admin(String Name , long Unique_ID , String Phone_number, String password){ + super(Name, Unique_ID , Phone_number); + this.password = password; + } + + public String getPassword() { + return password; + } + + @Override + public String getName() { + return super.getName(); + } +} From 22a38d23dcbef746bd68e90ec8ac48a59118a5ee Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:28:46 +0330 Subject: [PATCH 04/10] classnormal user added --- Answers/src/main/java/NormalUser.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Answers/src/main/java/NormalUser.java diff --git a/Answers/src/main/java/NormalUser.java b/Answers/src/main/java/NormalUser.java new file mode 100644 index 0000000..310b5a4 --- /dev/null +++ b/Answers/src/main/java/NormalUser.java @@ -0,0 +1,19 @@ +import java.time.LocalDate; + +public class NormalUser extends User { + LocalDate date; + public NormalUser(String Name , long Unique_ID , String Phone_number){ + super(Name, Unique_ID , Phone_number); + this.date = LocalDate.now(); + } + + @Override + public long getUnique_ID() { + return super.getUnique_ID(); + } + + @Override + public void setUnique_ID(int unique_ID) { + super.setUnique_ID(unique_ID); + } +} From 5e981d661b40d8985a3e5d311841d78b610a1b9a Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:30:13 +0330 Subject: [PATCH 05/10] class rent added --- Answers/src/main/java/Rent.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Answers/src/main/java/Rent.java diff --git a/Answers/src/main/java/Rent.java b/Answers/src/main/java/Rent.java new file mode 100644 index 0000000..d41aa7a --- /dev/null +++ b/Answers/src/main/java/Rent.java @@ -0,0 +1,26 @@ +import java.time.LocalDate; + +public class Rent { + Book bookie; + NormalUser NormUser; + int Rental_ID; + LocalDate Rental_date; +public Rent (Book bookie , NormalUser NormUser , int Rental_ID , LocalDate Rental_date){ + this.bookie = bookie; + this.NormUser = NormUser; + this.Rental_ID = Rental_ID; + this.Rental_date = Rental_date; +} + + public NormalUser getNormUser() { + return NormUser; + } + + public Book getBookie() { + return bookie; + } + + public int getRental_ID() { + return Rental_ID; + } +} From 24765bffb47227ed515eb26efebcbb331d9ca35f Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:30:50 +0330 Subject: [PATCH 06/10] class library added --- Answers/src/main/java/Library.java | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Answers/src/main/java/Library.java diff --git a/Answers/src/main/java/Library.java b/Answers/src/main/java/Library.java new file mode 100644 index 0000000..939efe0 --- /dev/null +++ b/Answers/src/main/java/Library.java @@ -0,0 +1,50 @@ +import java.time.LocalTime; +import java.util.ArrayList; + +public class Library { + String library_name; + int capacity ; + int operating_hours1; + int operating_hours2; + ArrayList book_repository = new ArrayList(); + ArrayList userArray = new ArrayList(); + ArrayList rental_registries = new ArrayList(); + ArrayList adminArray = new ArrayList(); + ArrayList usersArray = new ArrayList(); + + public Library (String library_name , int capacity, int operating_hours1 , int operating_hours2){ + this.library_name = library_name; + this.capacity = capacity; + this.operating_hours1 = operating_hours1; + this.operating_hours2 = operating_hours2; + this.book_repository = new ArrayList<>(); + this.userArray = new ArrayList<>(); + this.rental_registries = new ArrayList<>(); + this.adminArray = new ArrayList<>(); + this.usersArray = new ArrayList<>(); + + } + + public String getLibrary_name() { + return library_name; + } + public void setLibrary_name(String library_name) { + this.library_name = library_name; + } + + public int getOperating_hours1(){ + return operating_hours1; + } + + public void setOperating_hours1(int operating_hours1) { + this.operating_hours1 = operating_hours1; + } + + public int getOperating_hours2() { + return operating_hours2; + } + + public void setOperating_hours2(int operating_hours2) { + this.operating_hours2 = operating_hours2; + } +} From e1b9fda0e20ae1170fd9f9fda7fbba2bbe4e1ba7 Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:36:12 +0330 Subject: [PATCH 07/10] class user added --- Answers/src/main/java/User.java | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Answers/src/main/java/User.java b/Answers/src/main/java/User.java index 0d431aa..32a0883 100644 --- a/Answers/src/main/java/User.java +++ b/Answers/src/main/java/User.java @@ -1,11 +1,31 @@ public class User { - String Name; - int Unique_ID; - int Phone_number; + private String Name; + private long Unique_ID; + private String Phone_number; - public User(String Name , int Unique_ID , int Phone_number){ + public User(String Name , long Unique_ID , String Phone_number){ this.Name = Name; this.Unique_ID = Unique_ID; this.Phone_number = Phone_number; } + + public String getName() { + return Name; + } + /* public void setName(String name) { + Name = name; + }*/ + + public long getUnique_ID() { + return Unique_ID; + } + public void setUnique_ID(int unique_ID) { + Unique_ID = unique_ID; + } + + public String getPhone_number() { + return Phone_number; + } } + + From 743228e17a9982f5213eabaea7dfcebb10515364 Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:36:47 +0330 Subject: [PATCH 08/10] class book changed --- Answers/src/main/java/Book.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Answers/src/main/java/Book.java b/Answers/src/main/java/Book.java index fec7c9e..4889629 100644 --- a/Answers/src/main/java/Book.java +++ b/Answers/src/main/java/Book.java @@ -13,4 +13,20 @@ public Book(int bookId , String Title , String Author , boolean Availability_sta this.Description = Description; } + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public boolean getAvailability_status() { + return Availability_status; + } + + public void setAvailability_status(boolean availability_status) { + Availability_status = availability_status; + } } From 0e2c778aace9d77a3eecc7a29442507623f19d56 Mon Sep 17 00:00:00 2001 From: yekta Date: Thu, 16 May 2024 23:37:23 +0330 Subject: [PATCH 09/10] class CLI added --- Answers/src/main/java/CLI.java | 618 +++++++++++++++++++++++++++++++++ 1 file changed, 618 insertions(+) create mode 100644 Answers/src/main/java/CLI.java diff --git a/Answers/src/main/java/CLI.java b/Answers/src/main/java/CLI.java new file mode 100644 index 0000000..5128d04 --- /dev/null +++ b/Answers/src/main/java/CLI.java @@ -0,0 +1,618 @@ +import java.time.LocalDate; +import java.util.Objects; +import java.util.Scanner; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class CLI { + + public static final String RESET = "\033[0m"; + public static final String BLACK = "\033[0;30m"; + public static final String RED = "\033[0;31m"; + public static final String GREEN = "\033[0;32m"; + public static final String YELLOW = "\033[0;33m"; + public static final String BLUE = "\033[0;34m"; + public static final String PURPLE = "\033[0;35m"; + public static final String CYAN = "\033[0;36m"; + public static final String WHITE = "\033[0;37m"; + public static final String BLACK_BRIGHT = "\033[0;90m"; + public static final String RED_BRIGHT = "\033[0;91m"; + public static final String GREEN_BRIGHT = "\033[0;92m"; + public static final String YELLOW_BRIGHT = "\033[0;93m"; + public static final String BLUE_BRIGHT = "\033[0;94m"; + public static final String PURPLE_BRIGHT = "\033[0;95m"; + public static final String CYAN_BRIGHT = "\033[0;96m"; + public static final String WHITE_BRIGHT = "\033[0;97m"; + + private static int idCounter = 100; + + public static synchronized int createID() { + return idCounter++; + } + + public static void changeHours(Library l) { + int start = l.getOperating_hours1(); + int finished = l.getOperating_hours2(); + System.out.println(BLUE + "The library opens at " + start + " and " + "closes at " + finished + RESET); + System.out.println(BLUE + "if you want to change the library's operating hours enter YES" + RESET); + Scanner input = new Scanner(System.in); + + while (true) { + String entry = input.nextLine(); + if (Objects.equals(entry, "yes") || Objects.equals(entry, "YES")) { + System.out.println(BLUE + "please enter the opening hour : " + RESET); + while (true) { + System.out.print(BLUE+"Enter a number (0-24) for opening hour : " + RESET); + String userInput = input.nextLine(); + try { + int number = Integer.parseInt(userInput); + if (number >= 0 && number <= 24) { + System.out.println(GREEN + "You entered: " + number + RESET); + l.setOperating_hours1(number); + break; + } else { + System.out.println(RED +"Invalid input. Please enter a number between 0 and 24." +RESET); + } + } catch (NumberFormatException e) { + System.out.println(RED +"Invalid input. Please enter a number between 0 and 24."+RESET); + } + } + while (true) { + System.out.print(BLUE+"Enter a number (0-24) for closing hour : "+RESET); + String userInput = input.nextLine(); + try { + int number = Integer.parseInt(userInput); + + if (number >= 0 && number <= 24) { + System.out.println(GREEN + "You entered: " + number + RESET); + l.setOperating_hours2(number); + break; + } else { + System.out.println(RED +"Invalid input. Please enter a number between 0 and 24."+RESET); + } + } catch (NumberFormatException e) { + System.out.println(RED+"Invalid input. Please enter a number between 0 and 24."+RESET); + } + } + } else { + System.out.println(GREEN+"hmm..okay."+RESET); + break; + } + } + } + + public static void printUsers(Library l) { + System.out.println(BLUE+"Members registered in the library so far:"); + for (NormalUser userid : l.userArray) { + System.out.println(BLUE+"Name : " + userid.getName()); + System.out.println("Id : " + userid.getUnique_ID()); + System.out.println("Phone number : " + userid.getPhone_number()); + System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" +RESET); + } + } + + public static void addMember(String id, String pass, Library l) { +//چک میکنه ببینه آیا پسورد ادمین درست هست یا خیر + boolean adminValid = false; + for (Admin adminUser : l.adminArray) { + if (Objects.equals(pass, adminUser.getPassword())) { + adminValid = true; + break; + } + } + if (!adminValid) { + System.out.println(RED +"Invalid admin password."+RESET); + return; + } +//میگرده ببینه آیا این ایدی گرفته شده یا خیر + for (User user : l.usersArray) { + if (String.valueOf(user.getUnique_ID()).equals(id)) { + System.out.println(RED + "This ID is already taken." +RESET); + return; + } + } + //حالا میاد مشخصات مورد نیاز دیگه رو دریافت میکنه + Scanner input2 = new Scanner(System.in); + String name; + String phoneNumber; + + while (true) { + System.out.println(BLUE+"Enter their name please:" + RESET); + name = input2.nextLine().trim(); + if (name.matches("[a-zA-Z]+")) { + break; + } else { + System.out.println(RED +"You can only use alphabets." +RESET); + } + } + + while (true) { + System.out.println(BLUE+"Enter their phone number starting with 0 :" +RESET); + phoneNumber = input2.nextLine().trim(); + if (phoneNumber.matches("09\\d{9}")) { + break; + } else { + System.out.println(RED+"Wrong entry. Phone number should be 11 digits starting with 09."+RESET); + } + } +//حالا میاد یوزر رو تو ارری لیست هامون ادد میکنه + int userId = Integer.parseInt(id); + NormalUser normUser = new NormalUser(name, userId, phoneNumber); + l.userArray.add(normUser); + l.usersArray.add(normUser); + + System.out.println(GREEN+"You have successfully registered a new member." +RESET); + System.out.println(GREEN +"Their ID is " + id +RESET); + printUsers(l); + } + + public static void removeMember(String id, String pass, Library l){ + printUsers(l); + boolean adminValid = false; + for (Admin adminUser : l.adminArray) { + if (Objects.equals(pass, adminUser.getPassword())) { + adminValid = true; + break; + } + } + if (!adminValid) { + System.out.println(RED + "Invalid admin password."+RESET); + return; + } + + boolean removed = false; + NormalUser removeMember; + for (NormalUser user : l.userArray) { + if (String.valueOf(user.getUnique_ID()).equals(id)) { + removeMember = user; + int userId = Integer.parseInt(id); + String name = user.getName(); + String phoneNum = user.getPhone_number(); + l.userArray.remove(removeMember); + l.usersArray.remove(removeMember); + System.out.println(GREEN +"You have successfully removed a member with the following details : " ); + System.out.println("Name : " + name); + System.out.println("Id : " + id); + System.out.println("Phone number : " + phoneNum); + removed=true; + printUsers(l); + System.out.println(RESET); + return; + } + } + if (!removed) { + System.out.println(RED+"Member with " + id + " id not found in the library."+RESET); + return; + } + + } + + public static void adminPre() { + System.out.println(RED+"you are not in a position to do that, sorry."+RESET); + + } + + public static void memberRegistry(Library l) { + Scanner input2 = new Scanner(System.in); + System.out.println(BLUE + "Enter your name please." + RESET); + String name; + String phoneNumber; + while (true) { + name = input2.nextLine(); + name= name.trim(); + Pattern pr10 = Pattern.compile("[a-zA-Z]+"); + Matcher match10 = pr10.matcher(name); + if (match10.matches()) { + System.out.println(GREEN + "thanks." + RESET); + break; + } else { + System.out.println(RED + "you can not use anything beyond alphabet." + RESET); + } + } + System.out.println(BLUE + "Enter your phone number with 0 ." + RESET); + while (true) { + phoneNumber = input2.nextLine(); + if (phoneNumber.length() == 11) { + if (phoneNumber.charAt(0) == '0' && phoneNumber.charAt(1) == '9') { + Pattern pr11 = Pattern.compile("^[0-9]+"); + Matcher match11 = pr11.matcher(phoneNumber); + if (match11.find()) { + break; + } + } else System.out.println(RED + "wrong entry" + RESET); + } else { + System.out.println(RED + "wrong entry , phone number should be 11 digits." + RESET); + } + } + + int id = createID(); + NormalUser normUser = new NormalUser(name, id, phoneNumber); + l.userArray.add(normUser); + System.out.println(GREEN+ "you have successfully registered as a member." + RESET); + System.out.println(GREEN + "your id is " + id + RESET); + } + + public static void adminRegistry(Library l) { + Scanner input2 = new Scanner(System.in); + System.out.println(BLUE+"Enter your name please."+RESET); + String name; + String phoneNumber; + while (true) { + name = input2.nextLine(); + name= name.trim(); + Pattern pr10 = Pattern.compile("[a-zA-Z]+"); + Matcher match10 = pr10.matcher(name); + if (match10.matches()) { + break; + } else { + System.out.println(RED+"you can not use anything beyond alphabet."+RESET); + } + } + System.out.println(BLUE+"Enter your phone number."+RESET); + while (true) { + phoneNumber = input2.nextLine(); + if (phoneNumber.length() == 11) { + if (phoneNumber.charAt(0) == '0' && phoneNumber.charAt(1) == '9') { + Pattern pr11 = Pattern.compile("^[0-9]+"); + Matcher match11 = pr11.matcher(phoneNumber); + if (match11.find()) { + break; + } + } else System.out.println(RED+"wrong entry"+RESET); + } else { + System.out.println(RED+"wrong entry"+RESET); + } + } + System.out.println(BLUE+"Please enter your password : "+RESET); + Scanner input3 = new Scanner(System.in); + String pass; + while (true){ + pass = input3.nextLine(); + if (pass.contains(" ")) { + System.out.println(RED+"Invalid password.Spaces are not allowed."+RESET); + } else { + //System.out.println("Password set successfully!"); + break; + } + } + int id = createID(); + System.out.println(GREEN + "You have successfully registered as an admin." + RESET); + System.out.println(GREEN + "Your id is " + id + " and your password is " + pass + RESET); + User adminAdd = new User(name, id, phoneNumber); + Admin adminUser = new Admin(name, id, phoneNumber, pass); + l.adminArray.add(adminUser); + l.usersArray.add(adminAdd); + } + + static int Bookid = 0; + public static int booksId() { + return Bookid++; + } + + + public static Book Book(String bookName, String author, String subtitle, int id, boolean Availability_status) { + Book myBook = new Book(id, bookName, author, Availability_status, subtitle); + return myBook; + } + + public static void addBook(Library l, Book b) { + l.book_repository.add(b); + System.out.println(GREEN+"you have successfully added the book " + b.getTitle()+RESET); + } + + public static void rentBook(Library l, String name) { + boolean bookFound = false; + for (Book book_repo : l.book_repository) { + if (book_repo.getTitle().equals(name)) { + bookFound = true; + if (book_repo.getAvailability_status()) { + Scanner input2 = new Scanner(System.in); + String nameMember; + String id; + while (true) { + System.out.println(BLUE+"Enter the name please :"+RESET); + nameMember = input2.nextLine().trim(); + if (nameMember.matches("[a-zA-Z]+")) { + break; + } else { + System.out.println(RED+"You can only use alphabets."+RESET); + } + } + + while (true) { + System.out.println(BLUE+"Enter the id please:"+RESET); + id = input2.nextLine().trim(); + if (id.matches("[0-9]+")) { + break; + } else { + System.out.println(RED+"Wrong entry. ID should be digits only."+RESET); + } + } + int userId = Integer.parseInt(id); + boolean userFound = false; + + for (NormalUser NormUser : l.userArray) { + if (NormUser.getUnique_ID() == userId) { + userFound = true; + if (nameMember.equals(NormUser.getName())) { + int rentId = createID(); + LocalDate now = LocalDate.now(); + Rent rented = new Rent(book_repo, NormUser, rentId, now); + book_repo.setAvailability_status(false); + System.out.println(PURPLE+"You have rented the book named " + name + " successfully."); + System.out.println("Your rental id is " + rentId + " on " + now); + System.out.println("Please remember your rental id, you will need it for returning the book."+RESET); + l.rental_registries.add(rented); + return; + } else { + System.out.println(RED+"The name doesn't match the id."+RESET); + return; + } + } + } + if (!userFound) { + System.out.println(RED+"The id doesn't exist."+RESET); + } + return; + } else { + System.out.println(RED+"Sorry, we can't give it to you, someone else has rented the book."+RESET); + return; + } + } + } + if (!bookFound) { + System.out.println(RED+"We don't have this book, you can add it later if you want."+RESET); + } + } + + public static void availableBooks(Library l) { + boolean noBooks = true; + for (Book book : l.book_repository) { + if (book.getAvailability_status()) { + System.out.println(BLUE); + System.out.println(book.getTitle()); + System.out.println(RESET); + noBooks=false; + } + } + if (noBooks){ + System.out.println(RED+"We don't have any books available, sorry."+RESET); + } + } + + public static void returnBook(Library l, String name) { + boolean bookFound = false; + for (Rent rent : l.rental_registries) { + if (rent.bookie.getTitle().equals(name)) { + bookFound = true; + if (!rent.bookie.getAvailability_status()) { + Scanner input2 = new Scanner(System.in); + String nameMember; + String idMember; + String rentalId; + + while (true) { + System.out.println(BLUE+"Enter your name : "+RESET); + nameMember = input2.nextLine().trim(); + if (nameMember.matches("[a-zA-Z]+")) { + break; + } else { + System.out.println(RED+"Sorry, you must only use alphabets."+RESET); + } + } + while (true) { + System.out.println(BLUE+"Enter your id : "+RESET); + idMember = input2.nextLine().trim(); + if (idMember.matches("[0-9]+")) { + break; + } else { + System.out.println(RED+"Sorry, you must only use digits."+RESET); + } + } + while (true) { + System.out.println(BLUE+"Enter the rental id :"+RESET); + rentalId = input2.nextLine().trim(); + if (rentalId.matches("[0-9]+")) { + break; + } else { + System.out.println(RED+"Sorry, you must only use digits."+RESET); + } + } + + int intRentalId = Integer.parseInt(rentalId); + int intMemberId = Integer.parseInt(idMember); + + if (rent.Rental_ID==intRentalId && rent.NormUser.getUnique_ID()==intMemberId && nameMember.equals(rent.NormUser.getName())) { + rent.bookie.setAvailability_status(true); + l.rental_registries.remove(rent); + System.out.println(GREEN+"You have returned the book named " + name + " successfully."+RESET); + return; + } else { + System.out.println(RED+"Your rental ID or member information is incorrect."+RESET); + return; + } + } else { + System.out.println(RED+"The book is already available in the library."+RESET); + return; + } + } + } + if (!bookFound) { + System.out.println(RED+"The book is not registered in our library."+RESET); + } + } + + public static void rentBookie(Library l,String name ,String memberName ,String memberId){ + boolean bookFound = false; + for (Book book_repo : l.book_repository) { + if (book_repo.getTitle().equals(name)) { + bookFound = true; + if (book_repo.getAvailability_status()) { + + int userId = Integer.parseInt(memberId); + boolean userFound = false; + + for (NormalUser NormUser : l.userArray) { + if (NormUser.getUnique_ID() == userId) { + userFound = true; + if (memberName.equals(NormUser.getName())) { + int rentId = createID(); + LocalDate now = LocalDate.now(); + Rent rented = new Rent(book_repo, NormUser, rentId, now); + book_repo.setAvailability_status(false); + System.out.println(GREEN+"You have rented the book named " + name + " successfully."+RESET); + System.out.println(GREEN+"Your rental ID is " + rentId + " on " + now + "."); + System.out.println("Please remember your rental id, you will need it for returning the book."+RESET); + l.rental_registries.add(rented); + return; + } else { + System.out.println(RED+"The name doesn't match the ID."+RESET); + return; + } + } + } + if (!userFound) { + System.out.println(RED+"The ID doesn't exist."+RESET); + } + return; + } else { + System.out.println(RED+"Sorry, we can't give it to you, someone else has rented the book."+RESET); + return; + } + } + } + if (!bookFound) { + System.out.println(RED+"We don't have this book, you can add it later if you want."+RESET); + } + } + + public static void finito() { + System.out.println(CYAN+"there is only one thing that could replace a new book, the next book ;)\n"); + System.out.println("hope you enjoyed the moments you used our library."+RESET); + } + + public static boolean regex(String s, Library lib, boolean b) { + Pattern pr1 = Pattern.compile("^lib\\s+add\\s+book\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>"); + Matcher match1 = pr1.matcher(s); + if (match1.find()) { + addBook(lib, Book(match1.group(1), match1.group(2), match1.group(3), booksId(), true)); + return true; + } + + Pattern pr2 = Pattern.compile("^lib\\s+get\\s+hrs"); + Matcher match2 = pr2.matcher(s); + if (match2.find()) { + if (!b){ + changeHours(lib); + return true;} + else {adminPre(); + return false; + } + } + + Pattern pr3 = Pattern.compile("^lib\\s+rent\\s+<([a-zA-Z0-9]+)>"); + Matcher match3 = pr3.matcher(s); + if (match3.matches()) { + rentBook(lib, match3.group(1)); + return true; + } + + Pattern pr4 = Pattern.compile("^lib\\s+add\\s+member\\s+<([0-9]+)>\\s+<([^\\s]+)>"); + Matcher match4 = pr4.matcher(s); + if (match4.find()) { + if (b == false) { + addMember(match4.group(1) , match4.group(2) , lib); + return true; + } else { + adminPre(); + } + } + + Pattern pr5 = Pattern.compile("^lib\\s+rent\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>\\s+<([a-zA-Z]+(?:\\s+[a-zA-Z]*)*)>\\s+<([0-9]+)>"); + Matcher match5 = pr5.matcher(s); + if (match5.find()) { + rentBookie(lib,match5.group(1),match5.group(2),match5.group(3)); + return true; + } + + Pattern pr6 = Pattern.compile("^lib\\s+get\\s+available\\s+books"); + Matcher match6 = pr6.matcher(s); + if (match6.find()) { + availableBooks(lib); + return true; + } + + Pattern pr7 = Pattern.compile("^lib\\s+remove\\s+member\\s+<([0-9]+)>\\s+<([^\\s]+)>"); + Matcher match7 = pr7.matcher(s); + if (match7.find()) { + if (b == false) { + removeMember(match7.group(1) ,match7.group(2) , lib); + return true; + } else { + adminPre(); + } + } + + Pattern pr8 = Pattern.compile("^lib\\s+return\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>"); + Matcher match8 = pr8.matcher(s); + if (match8.find()) { + returnBook(lib, match8.group(1)); + return true; + } + + Pattern pr9 = Pattern.compile("^lib\\s+finished\\s*"); + Matcher match9 = pr9.matcher(s); + if (match9.find()) { + finito(); + return false; + } + return false; + } + + public static void commands() { + System.out.println(PURPLE + "If you want to Add a new book to the library" + YELLOW + " ---------->>" + PURPLE +" lib add book \n" + RESET); + System.out.println(PURPLE + "If you want to Retrieve library operating hours" + YELLOW + " ---------->>" + PURPLE +" lib get hrs\n" + RESET); + System.out.println(PURPLE + "If you want to Rent a book from the library" + YELLOW + " ---------->>" + PURPLE + " lib rent \n" + RESET); + System.out.println(PURPLE + "If you want to Add a new member to the library (admin privilege required)" + YELLOW +" ---------->>" + PURPLE + " lib add member \n" + RESET); + System.out.println(PURPLE + "If you want to Rent a book for a specific member" + YELLOW + " ---------->>" + PURPLE + " lib rent \n" + RESET); + System.out.println(PURPLE + "If you want to View available books for rental" + YELLOW + " ---------->>" + PURPLE + " lib get available books.\n" + RESET); + System.out.println(PURPLE + "If you want to Remove a member from the library (admin privilege required)" + YELLOW + " ---------->>" + PURPLE + " lib remove member \n"+RESET); + System.out.println(PURPLE + "If you want to Return a rented book to the library" + YELLOW + " ---------->>" + PURPLE + " lib return \n" + RESET); + System.out.println(PURPLE + "If you want to exit" + YELLOW + " ---------->>" + PURPLE + " lib finished\n" + RESET); + } + + public static void main(String[] args) { + Library myLib = new Library("ketabkhoone", 50, 9 ,9); + + System.out.println(BLUE + "welcome to our library\nif you want to enter as a normal user press 1.\nand if you want to enter as an admin press 2." + RESET); + Scanner scanner = new Scanner(System.in); + Boolean adminOrUser; + while (true) { + String entry1 = scanner.nextLine(); + if (Objects.equals(entry1, "1")) { + memberRegistry(myLib); + adminOrUser = true; + break; + } else if (Objects.equals(entry1, "2")) { + adminRegistry(myLib); + adminOrUser = false; + break; + } else { + System.out.println(RED + "wrong entry , try again.\n" + RESET); + } + } + + while (true) { + commands(); + Scanner input = new Scanner(System.in); + String entry = input.nextLine(); + if (regex(entry, myLib, adminOrUser)) { + continue; + } else if (!Objects.equals(entry, "lib finished")) { + System.out.println(RED+"wrong entry, try again.\n"+RESET); + } else if (entry.equals("lib finished")) { + break; + } + } + } +} From b8864afa9389d2f481b73ffae5ced393e95e791f Mon Sep 17 00:00:00 2001 From: yekta Date: Fri, 24 May 2024 20:40:12 +0330 Subject: [PATCH 10/10] Book and CLI class changed --- Answers/.idea/.gitignore | 3 + Answers/.idea/.name | 1 + Answers/.idea/compiler.xml | 13 + Answers/.idea/jarRepositories.xml | 20 + Answers/.idea/misc.xml | 14 + Answers/.idea/vcs.xml | 6 + .../library-management/.idea/workspace.xml | 126 ++++++ Answers/pom.xml | 16 + Answers/src/main/java/.idea/.gitignore | 3 + Answers/src/main/java/.idea/misc.xml | 6 + Answers/src/main/java/.idea/modules.xml | 8 + Answers/src/main/java/.idea/vcs.xml | 6 + Answers/src/main/java/Book.java | 8 + Answers/src/main/java/CLI.java | 422 +++++++++--------- Answers/src/main/java/Main.java | 6 + Answers/src/main/java/main.iml | 11 + .../java/out/production/main/.idea/.gitignore | 3 + .../java/out/production/main/.idea/misc.xml | 6 + .../out/production/main/.idea/modules.xml | 8 + .../java/out/production/main/.idea/vcs.xml | 6 + .../main/java/out/production/main/Admin.class | Bin 0 -> 651 bytes .../main/java/out/production/main/Book.class | Bin 0 -> 1168 bytes .../main/java/out/production/main/CLI.class | Bin 0 -> 19101 bytes .../java/out/production/main/Library.class | Bin 0 -> 1699 bytes .../main/java/out/production/main/Main.class | Bin 0 -> 355 bytes .../java/out/production/main/NormalUser.class | Bin 0 -> 720 bytes .../main/java/out/production/main/Rent.class | Bin 0 -> 792 bytes .../main/java/out/production/main/User.class | Bin 0 -> 825 bytes .../main/java/out/production/main/main.iml | 11 + Answers/target/classes/Admin.class | Bin 0 -> 651 bytes Answers/target/classes/Book.class | Bin 0 -> 1017 bytes Answers/target/classes/CLI.class | Bin 0 -> 18518 bytes Answers/target/classes/Library.class | Bin 0 -> 1699 bytes Answers/target/classes/Main.class | Bin 0 -> 355 bytes Answers/target/classes/NormalUser.class | Bin 0 -> 720 bytes Answers/target/classes/Rent.class | Bin 0 -> 792 bytes Answers/target/classes/User.class | Bin 0 -> 825 bytes 37 files changed, 501 insertions(+), 202 deletions(-) create mode 100644 Answers/.idea/.gitignore create mode 100644 Answers/.idea/.name create mode 100644 Answers/.idea/compiler.xml create mode 100644 Answers/.idea/jarRepositories.xml create mode 100644 Answers/.idea/misc.xml create mode 100644 Answers/.idea/vcs.xml create mode 100644 Answers/library-management/.idea/workspace.xml create mode 100644 Answers/pom.xml create mode 100644 Answers/src/main/java/.idea/.gitignore create mode 100644 Answers/src/main/java/.idea/misc.xml create mode 100644 Answers/src/main/java/.idea/modules.xml create mode 100644 Answers/src/main/java/.idea/vcs.xml create mode 100644 Answers/src/main/java/Main.java create mode 100644 Answers/src/main/java/main.iml create mode 100644 Answers/src/main/java/out/production/main/.idea/.gitignore create mode 100644 Answers/src/main/java/out/production/main/.idea/misc.xml create mode 100644 Answers/src/main/java/out/production/main/.idea/modules.xml create mode 100644 Answers/src/main/java/out/production/main/.idea/vcs.xml create mode 100644 Answers/src/main/java/out/production/main/Admin.class create mode 100644 Answers/src/main/java/out/production/main/Book.class create mode 100644 Answers/src/main/java/out/production/main/CLI.class create mode 100644 Answers/src/main/java/out/production/main/Library.class create mode 100644 Answers/src/main/java/out/production/main/Main.class create mode 100644 Answers/src/main/java/out/production/main/NormalUser.class create mode 100644 Answers/src/main/java/out/production/main/Rent.class create mode 100644 Answers/src/main/java/out/production/main/User.class create mode 100644 Answers/src/main/java/out/production/main/main.iml create mode 100644 Answers/target/classes/Admin.class create mode 100644 Answers/target/classes/Book.class create mode 100644 Answers/target/classes/CLI.class create mode 100644 Answers/target/classes/Library.class create mode 100644 Answers/target/classes/Main.class create mode 100644 Answers/target/classes/NormalUser.class create mode 100644 Answers/target/classes/Rent.class create mode 100644 Answers/target/classes/User.class diff --git a/Answers/.idea/.gitignore b/Answers/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Answers/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Answers/.idea/.name b/Answers/.idea/.name new file mode 100644 index 0000000..17b1111 --- /dev/null +++ b/Answers/.idea/.name @@ -0,0 +1 @@ +lms40230212039 \ No newline at end of file diff --git a/Answers/.idea/compiler.xml b/Answers/.idea/compiler.xml new file mode 100644 index 0000000..9f99eb7 --- /dev/null +++ b/Answers/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Answers/.idea/jarRepositories.xml b/Answers/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/Answers/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Answers/.idea/misc.xml b/Answers/.idea/misc.xml new file mode 100644 index 0000000..82dbec8 --- /dev/null +++ b/Answers/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Answers/.idea/vcs.xml b/Answers/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Answers/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/library-management/.idea/workspace.xml b/Answers/library-management/.idea/workspace.xml new file mode 100644 index 0000000..c34d66b --- /dev/null +++ b/Answers/library-management/.idea/workspace.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1714470294438 + + + + \ No newline at end of file diff --git a/Answers/pom.xml b/Answers/pom.xml new file mode 100644 index 0000000..af385b1 --- /dev/null +++ b/Answers/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + org.example + lms40230212039 + 1.0-SNAPSHOT + + + 17 + 17 + + + \ No newline at end of file diff --git a/Answers/src/main/java/.idea/.gitignore b/Answers/src/main/java/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Answers/src/main/java/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Answers/src/main/java/.idea/misc.xml b/Answers/src/main/java/.idea/misc.xml new file mode 100644 index 0000000..a818314 --- /dev/null +++ b/Answers/src/main/java/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/.idea/modules.xml b/Answers/src/main/java/.idea/modules.xml new file mode 100644 index 0000000..122a905 --- /dev/null +++ b/Answers/src/main/java/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/.idea/vcs.xml b/Answers/src/main/java/.idea/vcs.xml new file mode 100644 index 0000000..4fce1d8 --- /dev/null +++ b/Answers/src/main/java/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/Book.java b/Answers/src/main/java/Book.java index 4889629..633fb52 100644 --- a/Answers/src/main/java/Book.java +++ b/Answers/src/main/java/Book.java @@ -22,6 +22,14 @@ public void setTitle(String title) { Title = title; } + public String getAuthor() { + return Author; + } + + public String getDescription() { + return Description; + } + public boolean getAvailability_status() { return Availability_status; } diff --git a/Answers/src/main/java/CLI.java b/Answers/src/main/java/CLI.java index 5128d04..9fbdfcb 100644 --- a/Answers/src/main/java/CLI.java +++ b/Answers/src/main/java/CLI.java @@ -23,6 +23,7 @@ public class CLI { public static final String PURPLE_BRIGHT = "\033[0;95m"; public static final String CYAN_BRIGHT = "\033[0;96m"; public static final String WHITE_BRIGHT = "\033[0;97m"; + public static boolean adminOrUser; private static int idCounter = 100; @@ -30,64 +31,68 @@ public static synchronized int createID() { return idCounter++; } - public static void changeHours(Library l) { - int start = l.getOperating_hours1(); - int finished = l.getOperating_hours2(); - System.out.println(BLUE + "The library opens at " + start + " and " + "closes at " + finished + RESET); - System.out.println(BLUE + "if you want to change the library's operating hours enter YES" + RESET); - Scanner input = new Scanner(System.in); + public static void changeHours(Library l , boolean b) { + if (!b) { + int start = l.getOperating_hours1(); + int finished = l.getOperating_hours2(); + System.out.println(BLUE + "The library opens at " + start + " and " + "closes at " + finished + RESET); + System.out.println(BLUE + "if you want to change the library's operating hours enter YES" + RESET); + Scanner input = new Scanner(System.in); - while (true) { - String entry = input.nextLine(); - if (Objects.equals(entry, "yes") || Objects.equals(entry, "YES")) { - System.out.println(BLUE + "please enter the opening hour : " + RESET); - while (true) { - System.out.print(BLUE+"Enter a number (0-24) for opening hour : " + RESET); - String userInput = input.nextLine(); - try { - int number = Integer.parseInt(userInput); - if (number >= 0 && number <= 24) { - System.out.println(GREEN + "You entered: " + number + RESET); - l.setOperating_hours1(number); - break; - } else { - System.out.println(RED +"Invalid input. Please enter a number between 0 and 24." +RESET); + while (true) { + String entry = input.nextLine(); + if (Objects.equals(entry, "yes") || Objects.equals(entry, "YES")) { + System.out.println(BLUE + "please enter the opening hour : " + RESET); + while (true) { + System.out.print(BLUE + "Enter a number (0-24) for opening hour : " + RESET); + String userInput = input.nextLine(); + try { + int number = Integer.parseInt(userInput); + if (number >= 0 && number <= 24) { + System.out.println(GREEN + "You entered: " + number + RESET); + l.setOperating_hours1(number); + break; + } else { + System.out.println(RED + "Invalid input. Please enter a number between 0 and 24." + RESET); + } + } catch (NumberFormatException e) { + System.out.println(RED + "Invalid input. Please enter a number between 0 and 24." + RESET); } - } catch (NumberFormatException e) { - System.out.println(RED +"Invalid input. Please enter a number between 0 and 24."+RESET); } - } - while (true) { - System.out.print(BLUE+"Enter a number (0-24) for closing hour : "+RESET); - String userInput = input.nextLine(); - try { - int number = Integer.parseInt(userInput); - - if (number >= 0 && number <= 24) { - System.out.println(GREEN + "You entered: " + number + RESET); - l.setOperating_hours2(number); - break; - } else { - System.out.println(RED +"Invalid input. Please enter a number between 0 and 24."+RESET); + while (true) { + System.out.print(BLUE + "Enter a number (0-24) for closing hour : " + RESET); + String userInput = input.nextLine(); + try { + int number = Integer.parseInt(userInput); + + if (number >= 0 && number <= 24) { + System.out.println(GREEN + "You entered: " + number + RESET); + l.setOperating_hours2(number); + break; + } else { + System.out.println(RED + "Invalid input. Please enter a number between 0 and 24." + RESET); + } + } catch (NumberFormatException e) { + System.out.println(RED + "Invalid input. Please enter a number between 0 and 24." + RESET); } - } catch (NumberFormatException e) { - System.out.println(RED+"Invalid input. Please enter a number between 0 and 24."+RESET); } + } else { + System.out.println(GREEN + "hmm..okay." + RESET); + break; } - } else { - System.out.println(GREEN+"hmm..okay."+RESET); - break; } + } else { + System.out.println(BLUE + "The library opens at " + l.getOperating_hours1() + " and " + "closes at " + l.getOperating_hours2() + RESET); } } public static void printUsers(Library l) { - System.out.println(BLUE+"Members registered in the library so far:"); + System.out.println(BLUE + "Members registered in the library so far:"); for (NormalUser userid : l.userArray) { - System.out.println(BLUE+"Name : " + userid.getName()); + System.out.println(BLUE + "Name : " + userid.getName()); System.out.println("Id : " + userid.getUnique_ID()); System.out.println("Phone number : " + userid.getPhone_number()); - System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" +RESET); + System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" + RESET); } } @@ -101,13 +106,13 @@ public static void addMember(String id, String pass, Library l) { } } if (!adminValid) { - System.out.println(RED +"Invalid admin password."+RESET); + System.out.println(RED + "Invalid admin password." + RESET); return; } //میگرده ببینه آیا این ایدی گرفته شده یا خیر for (User user : l.usersArray) { if (String.valueOf(user.getUnique_ID()).equals(id)) { - System.out.println(RED + "This ID is already taken." +RESET); + System.out.println(RED + "This ID is already taken." + RESET); return; } } @@ -117,22 +122,22 @@ public static void addMember(String id, String pass, Library l) { String phoneNumber; while (true) { - System.out.println(BLUE+"Enter their name please:" + RESET); + System.out.println(BLUE + "Enter their name please:" + RESET); name = input2.nextLine().trim(); if (name.matches("[a-zA-Z]+")) { break; } else { - System.out.println(RED +"You can only use alphabets." +RESET); + System.out.println(RED + "You can only use alphabets." + RESET); } } while (true) { - System.out.println(BLUE+"Enter their phone number starting with 0 :" +RESET); + System.out.println(BLUE + "Enter their phone number starting with 0 :" + RESET); phoneNumber = input2.nextLine().trim(); if (phoneNumber.matches("09\\d{9}")) { break; } else { - System.out.println(RED+"Wrong entry. Phone number should be 11 digits starting with 09."+RESET); + System.out.println(RED + "Wrong entry. Phone number should be 11 digits starting with 09." + RESET); } } //حالا میاد یوزر رو تو ارری لیست هامون ادد میکنه @@ -141,13 +146,13 @@ public static void addMember(String id, String pass, Library l) { l.userArray.add(normUser); l.usersArray.add(normUser); - System.out.println(GREEN+"You have successfully registered a new member." +RESET); - System.out.println(GREEN +"Their ID is " + id +RESET); + System.out.println(GREEN + "You have successfully registered a new member." + RESET); + System.out.println(GREEN + "Their ID is " + id + RESET); printUsers(l); } - public static void removeMember(String id, String pass, Library l){ - printUsers(l); + public static void removeMember(String id, String pass, Library l) { + printUsers(l); boolean adminValid = false; for (Admin adminUser : l.adminArray) { if (Objects.equals(pass, adminUser.getPassword())) { @@ -156,7 +161,7 @@ public static void removeMember(String id, String pass, Library l){ } } if (!adminValid) { - System.out.println(RED + "Invalid admin password."+RESET); + System.out.println(RED + "Invalid admin password." + RESET); return; } @@ -170,25 +175,25 @@ public static void removeMember(String id, String pass, Library l){ String phoneNum = user.getPhone_number(); l.userArray.remove(removeMember); l.usersArray.remove(removeMember); - System.out.println(GREEN +"You have successfully removed a member with the following details : " ); + System.out.println(GREEN + "You have successfully removed a member with the following details : "); System.out.println("Name : " + name); System.out.println("Id : " + id); System.out.println("Phone number : " + phoneNum); - removed=true; + removed = true; printUsers(l); System.out.println(RESET); return; } } if (!removed) { - System.out.println(RED+"Member with " + id + " id not found in the library."+RESET); + System.out.println(RED + "Member with " + id + " id not found in the library." + RESET); return; } } public static void adminPre() { - System.out.println(RED+"you are not in a position to do that, sorry."+RESET); + System.out.println(RED + "you are not in a position to do that, sorry." + RESET); } @@ -199,7 +204,7 @@ public static void memberRegistry(Library l) { String phoneNumber; while (true) { name = input2.nextLine(); - name= name.trim(); + name = name.trim(); Pattern pr10 = Pattern.compile("[a-zA-Z]+"); Matcher match10 = pr10.matcher(name); if (match10.matches()) { @@ -228,27 +233,27 @@ public static void memberRegistry(Library l) { int id = createID(); NormalUser normUser = new NormalUser(name, id, phoneNumber); l.userArray.add(normUser); - System.out.println(GREEN+ "you have successfully registered as a member." + RESET); + System.out.println(GREEN + "you have successfully registered as a member." + RESET); System.out.println(GREEN + "your id is " + id + RESET); } public static void adminRegistry(Library l) { Scanner input2 = new Scanner(System.in); - System.out.println(BLUE+"Enter your name please."+RESET); + System.out.println(BLUE + "Enter your name please." + RESET); String name; String phoneNumber; while (true) { name = input2.nextLine(); - name= name.trim(); + name = name.trim(); Pattern pr10 = Pattern.compile("[a-zA-Z]+"); Matcher match10 = pr10.matcher(name); if (match10.matches()) { break; } else { - System.out.println(RED+"you can not use anything beyond alphabet."+RESET); + System.out.println(RED + "you can not use anything beyond alphabet." + RESET); } } - System.out.println(BLUE+"Enter your phone number."+RESET); + System.out.println(BLUE + "Enter your phone number." + RESET); while (true) { phoneNumber = input2.nextLine(); if (phoneNumber.length() == 11) { @@ -258,18 +263,18 @@ public static void adminRegistry(Library l) { if (match11.find()) { break; } - } else System.out.println(RED+"wrong entry"+RESET); + } else System.out.println(RED + "wrong entry" + RESET); } else { - System.out.println(RED+"wrong entry"+RESET); + System.out.println(RED + "wrong entry" + RESET); } } - System.out.println(BLUE+"Please enter your password : "+RESET); + System.out.println(BLUE + "Please enter your password : " + RESET); Scanner input3 = new Scanner(System.in); String pass; - while (true){ - pass = input3.nextLine(); + while (true) { + pass = input3.nextLine(); if (pass.contains(" ")) { - System.out.println(RED+"Invalid password.Spaces are not allowed."+RESET); + System.out.println(RED + "Invalid password.Spaces are not allowed." + RESET); } else { //System.out.println("Password set successfully!"); break; @@ -285,11 +290,11 @@ public static void adminRegistry(Library l) { } static int Bookid = 0; + public static int booksId() { return Bookid++; } - public static Book Book(String bookName, String author, String subtitle, int id, boolean Availability_status) { Book myBook = new Book(id, bookName, author, Availability_status, subtitle); return myBook; @@ -297,72 +302,74 @@ public static Book Book(String bookName, String author, String subtitle, int id, public static void addBook(Library l, Book b) { l.book_repository.add(b); - System.out.println(GREEN+"you have successfully added the book " + b.getTitle()+RESET); + System.out.println(GREEN + "you have successfully added the book " + b.getTitle() + RESET); } - public static void rentBook(Library l, String name) { - boolean bookFound = false; - for (Book book_repo : l.book_repository) { - if (book_repo.getTitle().equals(name)) { - bookFound = true; - if (book_repo.getAvailability_status()) { - Scanner input2 = new Scanner(System.in); - String nameMember; - String id; - while (true) { - System.out.println(BLUE+"Enter the name please :"+RESET); - nameMember = input2.nextLine().trim(); - if (nameMember.matches("[a-zA-Z]+")) { - break; - } else { - System.out.println(RED+"You can only use alphabets."+RESET); + public static void rentBook(Library l, String name, boolean k) { + if (k) { + boolean bookFound = false; + for (Book book_repo : l.book_repository) { + if (book_repo.getTitle().equals(name)) { + bookFound = true; + if (book_repo.getAvailability_status()) { + Scanner input2 = new Scanner(System.in); + String nameMember; + String id; + while (true) { + System.out.println(BLUE + "Enter the name please :" + RESET); + nameMember = input2.nextLine().trim(); + if (nameMember.matches("[a-zA-Z]+")) { + break; + } else { + System.out.println(RED + "You can only use alphabets." + RESET); + } } - } - while (true) { - System.out.println(BLUE+"Enter the id please:"+RESET); - id = input2.nextLine().trim(); - if (id.matches("[0-9]+")) { - break; - } else { - System.out.println(RED+"Wrong entry. ID should be digits only."+RESET); - } - } - int userId = Integer.parseInt(id); - boolean userFound = false; - - for (NormalUser NormUser : l.userArray) { - if (NormUser.getUnique_ID() == userId) { - userFound = true; - if (nameMember.equals(NormUser.getName())) { - int rentId = createID(); - LocalDate now = LocalDate.now(); - Rent rented = new Rent(book_repo, NormUser, rentId, now); - book_repo.setAvailability_status(false); - System.out.println(PURPLE+"You have rented the book named " + name + " successfully."); - System.out.println("Your rental id is " + rentId + " on " + now); - System.out.println("Please remember your rental id, you will need it for returning the book."+RESET); - l.rental_registries.add(rented); - return; + while (true) { + System.out.println(BLUE + "Enter the id please:" + RESET); + id = input2.nextLine().trim(); + if (id.matches("[0-9]+")) { + break; } else { - System.out.println(RED+"The name doesn't match the id."+RESET); - return; + System.out.println(RED + "Wrong entry. ID should be digits only." + RESET); } } + int userId = Integer.parseInt(id); + boolean userFound = false; + + for (NormalUser NormUser : l.userArray) { + if (NormUser.getUnique_ID() == userId) { + userFound = true; + if (nameMember.equals(NormUser.getName())) { + int rentId = createID(); + LocalDate now = LocalDate.now(); + Rent rented = new Rent(book_repo, NormUser, rentId, now); + book_repo.setAvailability_status(false); + System.out.println(GREEN + "You have rented the book named " + name + " successfully."); + System.out.println("Your rental id is " + rentId + " on " + now); + System.out.println("Please remember your rental id, you will need it for returning the book." + RESET); + l.rental_registries.add(rented); + return; + } else { + System.out.println(RED + "The name doesn't match the id." + RESET); + return; + } + } + } + if (!userFound) { + System.out.println(RED + "The id doesn't exist." + RESET); + } + return; + } else { + System.out.println(RED + "Sorry, we can't give it to you, someone else has rented the book." + RESET); + return; } - if (!userFound) { - System.out.println(RED+"The id doesn't exist."+RESET); - } - return; - } else { - System.out.println(RED+"Sorry, we can't give it to you, someone else has rented the book."+RESET); - return; } } - } - if (!bookFound) { - System.out.println(RED+"We don't have this book, you can add it later if you want."+RESET); - } + if (!bookFound) { + System.out.println(RED + "We don't have this book, you can add it later if you want." + RESET); + } + } else System.out.println(RED + "you cant rent a book as an admin user." + RESET); } public static void availableBooks(Library l) { @@ -370,13 +377,15 @@ public static void availableBooks(Library l) { for (Book book : l.book_repository) { if (book.getAvailability_status()) { System.out.println(BLUE); - System.out.println(book.getTitle()); - System.out.println(RESET); - noBooks=false; + System.out.println("Name : " + book.getTitle()); + System.out.println("Author : " + book.getAuthor()); + System.out.println("Description : " + book.getDescription()); + System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" + RESET); + noBooks = false; } } - if (noBooks){ - System.out.println(RED+"We don't have any books available, sorry."+RESET); + if (noBooks) { + System.out.println(RED + "We don't have any books available, sorry." + RESET); } } @@ -392,103 +401,105 @@ public static void returnBook(Library l, String name) { String rentalId; while (true) { - System.out.println(BLUE+"Enter your name : "+RESET); + System.out.println(BLUE + "Enter your name : " + RESET); nameMember = input2.nextLine().trim(); if (nameMember.matches("[a-zA-Z]+")) { break; } else { - System.out.println(RED+"Sorry, you must only use alphabets."+RESET); + System.out.println(RED + "Sorry, you must only use alphabets." + RESET); } } while (true) { - System.out.println(BLUE+"Enter your id : "+RESET); + System.out.println(BLUE + "Enter your id : " + RESET); idMember = input2.nextLine().trim(); if (idMember.matches("[0-9]+")) { break; } else { - System.out.println(RED+"Sorry, you must only use digits."+RESET); + System.out.println(RED + "Sorry, you must only use digits." + RESET); } } while (true) { - System.out.println(BLUE+"Enter the rental id :"+RESET); + System.out.println(BLUE + "Enter the rental id :" + RESET); rentalId = input2.nextLine().trim(); if (rentalId.matches("[0-9]+")) { break; } else { - System.out.println(RED+"Sorry, you must only use digits."+RESET); + System.out.println(RED + "Sorry, you must only use digits." + RESET); } } int intRentalId = Integer.parseInt(rentalId); int intMemberId = Integer.parseInt(idMember); - if (rent.Rental_ID==intRentalId && rent.NormUser.getUnique_ID()==intMemberId && nameMember.equals(rent.NormUser.getName())) { + if (rent.Rental_ID == intRentalId && rent.NormUser.getUnique_ID() == intMemberId && nameMember.equals(rent.NormUser.getName())) { rent.bookie.setAvailability_status(true); l.rental_registries.remove(rent); - System.out.println(GREEN+"You have returned the book named " + name + " successfully."+RESET); + System.out.println(GREEN + "You have returned the book named " + name + " successfully." + RESET); return; } else { - System.out.println(RED+"Your rental ID or member information is incorrect."+RESET); + System.out.println(RED + "Your rental ID or member information is incorrect." + RESET); return; } } else { - System.out.println(RED+"The book is already available in the library."+RESET); + System.out.println(RED + "The book is already available in the library." + RESET); return; } } } if (!bookFound) { - System.out.println(RED+"The book is not registered in our library."+RESET); + System.out.println(RED + "The book is not registered in our library." + RESET); } } - public static void rentBookie(Library l,String name ,String memberName ,String memberId){ - boolean bookFound = false; - for (Book book_repo : l.book_repository) { - if (book_repo.getTitle().equals(name)) { - bookFound = true; - if (book_repo.getAvailability_status()) { - - int userId = Integer.parseInt(memberId); - boolean userFound = false; - - for (NormalUser NormUser : l.userArray) { - if (NormUser.getUnique_ID() == userId) { - userFound = true; - if (memberName.equals(NormUser.getName())) { - int rentId = createID(); - LocalDate now = LocalDate.now(); - Rent rented = new Rent(book_repo, NormUser, rentId, now); - book_repo.setAvailability_status(false); - System.out.println(GREEN+"You have rented the book named " + name + " successfully."+RESET); - System.out.println(GREEN+"Your rental ID is " + rentId + " on " + now + "."); - System.out.println("Please remember your rental id, you will need it for returning the book."+RESET); - l.rental_registries.add(rented); - return; - } else { - System.out.println(RED+"The name doesn't match the ID."+RESET); - return; + public static void rentBookie(Library l, String name, String memberName, String memberId, boolean k) { + if (k) { + boolean bookFound = false; + for (Book book_repo : l.book_repository) { + if (book_repo.getTitle().equals(name)) { + bookFound = true; + if (book_repo.getAvailability_status()) { + + int userId = Integer.parseInt(memberId); + boolean userFound = false; + + for (NormalUser NormUser : l.userArray) { + if (NormUser.getUnique_ID() == userId) { + userFound = true; + if (memberName.equals(NormUser.getName())) { + int rentId = createID(); + LocalDate now = LocalDate.now(); + Rent rented = new Rent(book_repo, NormUser, rentId, now); + book_repo.setAvailability_status(false); + System.out.println(GREEN + "You have rented the book named " + name + " successfully." + RESET); + System.out.println(GREEN + "Your rental ID is " + rentId + " on " + now + "."); + System.out.println("Please remember your rental id, you will need it for returning the book." + RESET); + l.rental_registries.add(rented); + return; + } else { + System.out.println(RED + "The name doesn't match the ID." + RESET); + return; + } } } + if (!userFound) { + System.out.println(RED + "The ID doesn't exist." + RESET); + } + return; + } else { + System.out.println(RED + "Sorry, we can't give it to you, someone else has rented the book." + RESET); + return; } - if (!userFound) { - System.out.println(RED+"The ID doesn't exist."+RESET); - } - return; - } else { - System.out.println(RED+"Sorry, we can't give it to you, someone else has rented the book."+RESET); - return; } } - } - if (!bookFound) { - System.out.println(RED+"We don't have this book, you can add it later if you want."+RESET); - } + if (!bookFound) { + System.out.println(RED + "We don't have this book, you can add it later if you want." + RESET); + } + } else System.out.println(RED + "you cant rent book as an admin user." + RESET); } public static void finito() { - System.out.println(CYAN+"there is only one thing that could replace a new book, the next book ;)\n"); - System.out.println("hope you enjoyed the moments you used our library."+RESET); + System.out.println(CYAN + "there is only one thing that could replace a new book, the next book ;)\n"); + System.out.println("hope you enjoyed the moments you used our library." + RESET); } public static boolean regex(String s, Library lib, boolean b) { @@ -502,18 +513,14 @@ public static boolean regex(String s, Library lib, boolean b) { Pattern pr2 = Pattern.compile("^lib\\s+get\\s+hrs"); Matcher match2 = pr2.matcher(s); if (match2.find()) { - if (!b){ - changeHours(lib); - return true;} - else {adminPre(); - return false; - } + changeHours(lib,b); + return true; } Pattern pr3 = Pattern.compile("^lib\\s+rent\\s+<([a-zA-Z0-9]+)>"); Matcher match3 = pr3.matcher(s); if (match3.matches()) { - rentBook(lib, match3.group(1)); + rentBook(lib, match3.group(1), b); return true; } @@ -521,7 +528,7 @@ public static boolean regex(String s, Library lib, boolean b) { Matcher match4 = pr4.matcher(s); if (match4.find()) { if (b == false) { - addMember(match4.group(1) , match4.group(2) , lib); + addMember(match4.group(1), match4.group(2), lib); return true; } else { adminPre(); @@ -531,7 +538,7 @@ public static boolean regex(String s, Library lib, boolean b) { Pattern pr5 = Pattern.compile("^lib\\s+rent\\s+<([a-zA-Z0-9]+(?:\\s+[a-zA-Z0-9]*)*)>\\s+<([a-zA-Z]+(?:\\s+[a-zA-Z]*)*)>\\s+<([0-9]+)>"); Matcher match5 = pr5.matcher(s); if (match5.find()) { - rentBookie(lib,match5.group(1),match5.group(2),match5.group(3)); + rentBookie(lib, match5.group(1), match5.group(2), match5.group(3), b); return true; } @@ -546,7 +553,7 @@ public static boolean regex(String s, Library lib, boolean b) { Matcher match7 = pr7.matcher(s); if (match7.find()) { if (b == false) { - removeMember(match7.group(1) ,match7.group(2) , lib); + removeMember(match7.group(1), match7.group(2), lib); return true; } else { adminPre(); @@ -566,27 +573,33 @@ public static boolean regex(String s, Library lib, boolean b) { finito(); return false; } + + Pattern pr10 = Pattern.compile("^lib\\s+login\\s*"); + Matcher match10 = pr10.matcher(s); + if (match10.find()) { + login(lib); + return true; + } + return false; } public static void commands() { - System.out.println(PURPLE + "If you want to Add a new book to the library" + YELLOW + " ---------->>" + PURPLE +" lib add book \n" + RESET); - System.out.println(PURPLE + "If you want to Retrieve library operating hours" + YELLOW + " ---------->>" + PURPLE +" lib get hrs\n" + RESET); + System.out.println(PURPLE + "If you want to Add a new book to the library" + YELLOW + " ---------->>" + PURPLE + " lib add book \n" + RESET); + System.out.println(PURPLE + "If you want to Retrieve library operating hours" + YELLOW + " ---------->>" + PURPLE + " lib get hrs\n" + RESET); System.out.println(PURPLE + "If you want to Rent a book from the library" + YELLOW + " ---------->>" + PURPLE + " lib rent \n" + RESET); - System.out.println(PURPLE + "If you want to Add a new member to the library (admin privilege required)" + YELLOW +" ---------->>" + PURPLE + " lib add member \n" + RESET); + System.out.println(PURPLE + "If you want to Add a new member to the library (admin privilege required)" + YELLOW + " ---------->>" + PURPLE + " lib add member \n" + RESET); System.out.println(PURPLE + "If you want to Rent a book for a specific member" + YELLOW + " ---------->>" + PURPLE + " lib rent \n" + RESET); System.out.println(PURPLE + "If you want to View available books for rental" + YELLOW + " ---------->>" + PURPLE + " lib get available books.\n" + RESET); - System.out.println(PURPLE + "If you want to Remove a member from the library (admin privilege required)" + YELLOW + " ---------->>" + PURPLE + " lib remove member \n"+RESET); + System.out.println(PURPLE + "If you want to Remove a member from the library (admin privilege required)" + YELLOW + " ---------->>" + PURPLE + " lib remove member \n" + RESET); System.out.println(PURPLE + "If you want to Return a rented book to the library" + YELLOW + " ---------->>" + PURPLE + " lib return \n" + RESET); + System.out.println(PURPLE + "If you want to back to login page" + YELLOW + " ---------->>" + PURPLE + " lib login\n" + RESET); System.out.println(PURPLE + "If you want to exit" + YELLOW + " ---------->>" + PURPLE + " lib finished\n" + RESET); } - public static void main(String[] args) { - Library myLib = new Library("ketabkhoone", 50, 9 ,9); - + public static void login(Library myLib) { System.out.println(BLUE + "welcome to our library\nif you want to enter as a normal user press 1.\nand if you want to enter as an admin press 2." + RESET); Scanner scanner = new Scanner(System.in); - Boolean adminOrUser; while (true) { String entry1 = scanner.nextLine(); if (Objects.equals(entry1, "1")) { @@ -601,7 +614,12 @@ public static void main(String[] args) { System.out.println(RED + "wrong entry , try again.\n" + RESET); } } + } + + public static void main(String[] args) { + Library myLib = new Library("ketabkhoone", 50, 9, 9); + login(myLib); while (true) { commands(); Scanner input = new Scanner(System.in); @@ -609,7 +627,7 @@ public static void main(String[] args) { if (regex(entry, myLib, adminOrUser)) { continue; } else if (!Objects.equals(entry, "lib finished")) { - System.out.println(RED+"wrong entry, try again.\n"+RESET); + System.out.println(RED + "wrong entry, try again.\n" + RESET); } else if (entry.equals("lib finished")) { break; } diff --git a/Answers/src/main/java/Main.java b/Answers/src/main/java/Main.java new file mode 100644 index 0000000..1ef8157 --- /dev/null +++ b/Answers/src/main/java/Main.java @@ -0,0 +1,6 @@ +public class Main { + + public static void main(String[] args) { + + } +} diff --git a/Answers/src/main/java/main.iml b/Answers/src/main/java/main.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/Answers/src/main/java/main.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/out/production/main/.idea/.gitignore b/Answers/src/main/java/out/production/main/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Answers/src/main/java/out/production/main/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Answers/src/main/java/out/production/main/.idea/misc.xml b/Answers/src/main/java/out/production/main/.idea/misc.xml new file mode 100644 index 0000000..a818314 --- /dev/null +++ b/Answers/src/main/java/out/production/main/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/out/production/main/.idea/modules.xml b/Answers/src/main/java/out/production/main/.idea/modules.xml new file mode 100644 index 0000000..122a905 --- /dev/null +++ b/Answers/src/main/java/out/production/main/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/out/production/main/.idea/vcs.xml b/Answers/src/main/java/out/production/main/.idea/vcs.xml new file mode 100644 index 0000000..4fce1d8 --- /dev/null +++ b/Answers/src/main/java/out/production/main/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/src/main/java/out/production/main/Admin.class b/Answers/src/main/java/out/production/main/Admin.class new file mode 100644 index 0000000000000000000000000000000000000000..8cc4f4037400034dd2ec1f412fd5f95e447c658e GIT binary patch literal 651 zcma)3%TB^j5Iq-KN=v1P_`p|m2bjplm8gl)m`EBzg0Lk88n^~-wJrKvnrKK|_yK;D zae5&xEDJX?XHM^#Gc*1A{`drNj(r0OBsC}|RHPV`cHsI9sWUEkc)?IA+4s(qQyn{E zSZ#$q7sFaTPL(@4($F;+CNeM?)XTwy3x@QA69mtmKVZnmWs!N-goPY~Hgv;=GjSOT zrE>f!!|DGw z$0C#@tYVd7o+=*w3d&aH=%A>~z$!)c9oj2V39M1fk^oSsjY>F$0#zr3NrH83P>#?h zwPq4+p(qV4Y!jzQE;3f>`wnso+bZSgy;^yL_CjE8mXf3{P38^Ng$bQ=iFk&UzvApt J@vgMk`vGbxb)WzM literal 0 HcmV?d00001 diff --git a/Answers/src/main/java/out/production/main/Book.class b/Answers/src/main/java/out/production/main/Book.class new file mode 100644 index 0000000000000000000000000000000000000000..1d06406cd159df7de254be41f7084ce682504690 GIT binary patch literal 1168 zcmZ`&+iuf95IvjNPLsN~+~@^LTA)qbOFp1bseq6wMexun4|zdOYNcCDj1s33|G{VQ z01^=r4}1V0g*dY*ZK;hS?aYp6=A1dR`Stt9PXN!*EFgny4wefWj>6)Ff9W?vf6#Bf z>0SiASiyO!2Rc4f$krR}JZ6y3q2OW`u7dSEirz7$OLKgtppGSB-o*kI89o}v=h0B1 z*t%(Z5)bvDe;|297bVHFPjwsy5~;YT;+{h3=+f7r-_@axKfWEsemowrdq;9sT&zmf z?8{)(8|n|Sjs^+`_2VQ+GSW$g8g0(;B038c7Fv1`ydJ;r2E$Xo8!}RCMLj=k`$H}F ztDqI1YtnIAGW~(VOh1Ut2nywTBZh!#+tSWMq~&GXVl>Rot<* z?t*LGV%4gk4KeC_we_{uTCGdntF6|yw$(oEs|$j8|8u|Zo0*Wf^!Hx$H*@!U?%B_| zcX;~CuKysS>8i_1in83~GAWyKm(NBM3lFsVNkGP!F*_3=Qwjj3o$FuAlP z7!M>v(Jh;rW3BPT1ih-BGQgx_8Q;gK3J)DagWTjZ=~x=v1IQI^iDWQ>Rbs6GwYXM; zABv4z77s;}E0XbGAW~h3lMXfMI2y)uOeC;1I42fu2qf2plFcY3l7VP4!8CAmP0bi< zzCJ!C1I%hK9Z$pEG{U5jbONC3V*{MAMYan^0m10rON?1<&?u&bgV&9(o;WEIYVxH3ak-v(-@}y8j#jxC_HXO zLm(Or#sx{GCY4b+lL`qeDQwh4TUs4#cxg0^6KaoV8e~HYgk=sHvswmKm^6_lF&WX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K|5hP6pi|gFHTu9t2^~YYc&QEB1Ny?q1oww3Bag-Pg%KDB?S00^~za z(7qcs9a8Eu^=MPWY6`5_;V#+X9+{BmlO+Bt5D_pvCU~&oebW1Y^yd5Wb#H;MAY=am zy<&mA|9*S_hh;*4Uw=KJ&{wD@1-AAux&3BJWoFO;HrDvK5?7qUFr zv=W@LUU{fdc`1xrukEn6Z7QG6RRwej5;IpI4StO(qC3?9_(%icF&#?>)L`mTLlDys zrPtJP^oBZ~-c`ftZ)ybnQ;kF}=mh#4w^gjh!2c@Y{;CxGT*fD;avr6|aS84RDvYMs^nTVg_o!*UX74pqngG|NN0!C4Bo0{aRR>DE<|p-kyW}#&EredLM@$tvDi;- z#ToI(dsG;SPVvk3U={dfIQ{u5q83A%`teyRirj>YremKN+OlaL^nMH4a%eq|Q)i&f z4WDI{ilfbdUh%2~+B|d#E0si>mk!{pt!T?dzT$bc4Q(beCwHsuXv;&+Up9_lEI|!704t6kbL_oDNIJj1^~2)#74iF~ZX& z2>+MTNVN0?Wt6Zxvr1N?R;e=JGJ?sv+I_!FFWpPf>Y%wjtgNUM%hk@&)>$I^$^9=-}ALmWj` zqy-##1`Zvk(JFzXBte!|9CjNHx}8?59pLPp&>*|?flC1B2#k=MJB7Q-3HpXlh_peS zuP(rMf6NmkSVtd7*@vkZ2JMKrSCZx{{v44HE*&mR@#Bdi)%f!kG~xmp^eRZRkChJ| z0-s?dbl*i7rPRgh5`0I&PLf&qzW%&Ye_pLWuhpN|>(71q^G5x7v;MqQf8M4)@6exj i>Ce0M=RNxKKK*&W{(Mk>9#9VpgxK%L>Y#dreE$nau>yVo literal 0 HcmV?d00001 diff --git a/Answers/src/main/java/out/production/main/Library.class b/Answers/src/main/java/out/production/main/Library.class new file mode 100644 index 0000000000000000000000000000000000000000..ef423d56939e59897e6898b6add127c50cd69942 GIT binary patch literal 1699 zcmb7ET~8B16g|_Hme$1ngYwkVw%$@!9`}m$a>CA2jg933C)O4+CcEfRuq*c|od_|FUK$XiJ+K<2px7A=wivCLZb$1}#ArHmwj2W+ z{ecM&SQ1m5DYyGBMa^%4K4v-V3#3&u9tU}09!F@6?C`S7=2J^Ht93e9l2eTt4uFsE zE6k6R#uajg)XtGnJEueKd?^snDf_U%m9yW~7pZgVyZR04ob#@}M4bcP)w6trf)9C_ z>k1%}@KXa$^iv4^2STq;5pE&U6JtFw-V>8O@shsK!jwMM!nB@hVNOp3TA1(o|0~y5 zV)0>>>n37cqX>|rC?c4U?+F@_48rCTfBQ~70d_JdJ#NDJ+$P~(dy!U42vAg?x{{S$@IEIH#2)~B_U4g+`zR0AKrc564wJI8c?v*yWxfbY5rdfys z0sl^FL%OLSl|Vn$M%`~Wxw1={SL_Vax{y^St#4Z*8G&wObdt#7h@~GlYDPJ06645iw$wkOet7e}i~!$1%~3 l!Fx#TeGAA(tRftv&yF)+v>NLE8iQX(ejQF);gINI^aY)bJ?8)b literal 0 HcmV?d00001 diff --git a/Answers/src/main/java/out/production/main/NormalUser.class b/Answers/src/main/java/out/production/main/NormalUser.class new file mode 100644 index 0000000000000000000000000000000000000000..94f5a6b21bab6cda607349aad43cce41925fbf3a GIT binary patch literal 720 zcmZuu%TC)s6g`tTF-ZsF@+{>|U$!eXACQ&}s8XURLISdd35>#2iLE*gd=(28C{-8z zfPPffGj>FZ=)%``?&F+u@BRJf=Pv+X5L8h>(S;*XLRr8$8|g%#{Mke%JrMBy_BVB- z>H`(^>nCYqqJE?GJQQ@Rm_x-yRpJGtz*5$gnxU?@<4ZL-QmGawM)9q{njho{Pt%PG z7Ep8HNxa0OK(!MmLp8_+Iae9L%6}W}49gNLSQU_cot{PJ`&gehkI3i;Et`HNv5wbF zkDjC*zZrBn^Eu-P28=9b;=3v__B{9rXVsy!3fAVxu#nJj$q;9?t}eCMQ3M$H}GsYOI9XjOCMs#va#H;PC`ME{e8DpVy<^ z;Ol~ZiGMHrxV!F5Ai^JTA25Hv=is77yTw-sht|V3cKEm6E}1Nchkd-s z7(KjY%wd$Pp0d@Mu~nsTf~7k;IfWGi$P8NM1yg8Y4>4^%V6`2k9BxdoHWO$sW``?r XJS%QBuX+?$#yh+xhQJ4A3-JE}?NNaK literal 0 HcmV?d00001 diff --git a/Answers/src/main/java/out/production/main/Rent.class b/Answers/src/main/java/out/production/main/Rent.class new file mode 100644 index 0000000000000000000000000000000000000000..3457b04dbcc44f48dcefd9cc8816d68e0ef7f2f0 GIT binary patch literal 792 zcmZuu%Wl&^6g`tTZzoOLv^0T0d9)-hA{%z4T|k8t$qEvWY^zB+DlSeexen`oP!}K( zA+g{C`cYNSokSw4EX#B6+}Anx%+2lJe*li~vWyI}1voBp$Sc$@^bg$&_4K^=adctE zi9-HuFb$Gpg>0ugETM=}0c95zxC+iEGnJB26nzg29seD@L#e8{SVLW*IEdoO*Gm&C zxW4#0l$)*DaIuMoLP^Hx@U(xTp!(9i?cxD;6e`QinNB!<%eVBBU}AcHG}hq>!-on7 zodxdd{C;X}cSzFjqcaX$^Mk1w%qAlff6=3mkqtX@sN+EH%b=5d3od0dVM46Rxk>)7 zRO@tCLAeUkqJgMUWYX%v)frw{l2Y~+%AccIJT@N!0k;~wmi_RQ0%Z6+4u8tb6QZTH z)XQ3`L+e2C-I_dGyj`&?N89rLKzRpq6ueh+RK4~b>t55DW9t{Q89bC4kKzm~invepwm!sZEfmuz~pQlImFqxzH10yuAj mbqlf>m|KD>r>0#Cs_9!Dd(!*CEOY&P%FN9ia|y8BZ9)WbUR3hr?d z|DHrA^{)!5Avc>Iwxo^sqc=>VlVmbzOFQ3RZq!&#Ra>0=W%!Ge*PC$?9cuW`u-(^O zhMlnA3P-V=XGt^d#bYXJ3hjLbryHer)C+!fc>syA-~nrHpuyz$QPTA5!o;0CP**1< zLLbY@9t|g>PV_Aney&jXAp62wZo=SeWN5inMusd*d#;Dxg5p=8E%G#ArA1#1uAzdx zDV$(?id;}Or`WjCuo7)a7uhi3KtBU*0a-lbUBE0G;5o|l63JktBN;7pit;wBQ+R>O zY;=uYs;uA-oJ$4<#{jlY=5*`3HrA}Q!b`lGgN->jcd-C2tOUQtn;H1CUJt0Xa!#@L lGUW#b!8Rv~w30qMb7>B?xnZIGZl#QkMH!WqOm;Ni-CHj^dl~=$ literal 0 HcmV?d00001 diff --git a/Answers/src/main/java/out/production/main/main.iml b/Answers/src/main/java/out/production/main/main.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/Answers/src/main/java/out/production/main/main.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Answers/target/classes/Admin.class b/Answers/target/classes/Admin.class new file mode 100644 index 0000000000000000000000000000000000000000..8cc4f4037400034dd2ec1f412fd5f95e447c658e GIT binary patch literal 651 zcma)3%TB^j5Iq-KN=v1P_`p|m2bjplm8gl)m`EBzg0Lk88n^~-wJrKvnrKK|_yK;D zae5&xEDJX?XHM^#Gc*1A{`drNj(r0OBsC}|RHPV`cHsI9sWUEkc)?IA+4s(qQyn{E zSZ#$q7sFaTPL(@4($F;+CNeM?)XTwy3x@QA69mtmKVZnmWs!N-goPY~Hgv;=GjSOT zrE>f!!|DGw z$0C#@tYVd7o+=*w3d&aH=%A>~z$!)c9oj2V39M1fk^oSsjY>F$0#zr3NrH83P>#?h zwPq4+p(qV4Y!jzQE;3f>`wnso+bZSgy;^yL_CjE8mXf3{P38^Ng$bQ=iFk&UzvApt J@vgMk`vGbxb)WzM literal 0 HcmV?d00001 diff --git a/Answers/target/classes/Book.class b/Answers/target/classes/Book.class new file mode 100644 index 0000000000000000000000000000000000000000..3c710287b503dff84ecce3fd42d216bd7accbf6b GIT binary patch literal 1017 zcmZ{j+iuf95QhIvZ0At-loOU6v0KST;!&5QY+nJV&piLcn=0Y@l-<^zG z?}nG&C{nPV>xqs!3h73(pF1-Og(QL}-1JP7%?8vRP z*WPp#>W`5QCJOCFH<={q86;iJKI?cDoO=qJJw5T>&OQvi@YEgp^b~r*$o2bfsO7wL z8qtL&j@6Uu+X~sS7sVwglp4)s1}di4igF_<5Ck)lCMZ-GY-ROq|A3zvY2|05F_17t z&M(=y{7EniN8TGP8FGUCOeTVT_A|wYU~=U^xl74NV#^W6mIH|`n@($jsMzItkEhSn zTeNlO2b8lrN5(mtW8FENW7{bkbCjH_Img{^afJI^YshfT!a$C{JT{oO$jnu&V~@|K z#;=`4OrGmJF?!6V;+@b5ab2Dm((z6Rjd&-FLb#6yT!pYjD>qH&JGQ@alY(Gav9l1T zvloJ8I)#ULM2}qVP%X(U=YR#>6d`{a@THneEWnk8>KfR>V}eNHCwRJybsMDgg_mxF e?5qT7pqT(+k4yi8)CjWo9}tI#0&);%Jp2oaZl-$x literal 0 HcmV?d00001 diff --git a/Answers/target/classes/CLI.class b/Answers/target/classes/CLI.class new file mode 100644 index 0000000000000000000000000000000000000000..5ba11328693fa22070a220bbb193ab524c2c84f5 GIT binary patch literal 18518 zcmb_j34B!5)j#KEGV?NdAt5oyh{(vIkOjgPBw^nq8Ws~411L>yBU96+i#fG0o(>S4a71Lk`S|BWY$e0x}Xo5)-X%dqWv(8D? zhhrAgQKS38kU`bJf0vc?(@8YdM>QtZ(zIR>+N=a5d#$rOLlG2C%*K=5U7LkDr)A74 zgM{&LaD!$sl{+Zxh*+VdUO;E68&>W^o&V>0If1zNkGujM9j;^Yl zFlkJ%EuQFarjUG|N%Mu?xtg+mI++&wsLrHQ=v4P)noH`i@Ot5Uqa&0^TBv>o57ZSC z(<0%*#WJFQRvSP|O*)Mlz-P(+WW|GdV5VhEv-QEoN9$r6Ly>T6Ff0@v8(f-=nDlX* zt<)yViUq5Jp;&8h!lbc+A0Mq?8kQ0F#TqpW;)!S|HUFFzt0NVT#|%3C%OJ5O5>Fn1 ze$fJ}Oj`XJhnZl|8Nh=+#e`^kG&*){d_$;9LuSxgrYeVWi!7m7GMKQ|hau_-OU{}t zEx}|w*cM9EnzWb!W-azvKnG=56aCX>z)iS$8{E)GSlV(9M8!ctq9PRJH0M|brjtg_5` zCY?`TVKTAI@>uxnPHS!5JPq9`#gs!^WyK4HNl*EV1uimayTDP11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7e}i~!$1%~3 l!Fx#TeGAA(tRftv&yF)+v>NLE8iQX(ejQF);gINI^aY)bJ?8)b literal 0 HcmV?d00001 diff --git a/Answers/target/classes/NormalUser.class b/Answers/target/classes/NormalUser.class new file mode 100644 index 0000000000000000000000000000000000000000..94f5a6b21bab6cda607349aad43cce41925fbf3a GIT binary patch literal 720 zcmZuu%TC)s6g`tTF-ZsF@+{>|U$!eXACQ&}s8XURLISdd35>#2iLE*gd=(28C{-8z zfPPffGj>FZ=)%``?&F+u@BRJf=Pv+X5L8h>(S;*XLRr8$8|g%#{Mke%JrMBy_BVB- z>H`(^>nCYqqJE?GJQQ@Rm_x-yRpJGtz*5$gnxU?@<4ZL-QmGawM)9q{njho{Pt%PG z7Ep8HNxa0OK(!MmLp8_+Iae9L%6}W}49gNLSQU_cot{PJ`&gehkI3i;Et`HNv5wbF zkDjC*zZrBn^Eu-P28=9b;=3v__B{9rXVsy!3fAVxu#nJj$q;9?t}eCMQ3M$H}GsYOI9XjOCMs#va#H;PC`ME{e8DpVy<^ z;Ol~ZiGMHrxV!F5Ai^JTA25Hv=is77yTw-sht|V3cKEm6E}1Nchkd-s z7(KjY%wd$Pp0d@Mu~nsTf~7k;IfWGi$P8NM1yg8Y4>4^%V6`2k9BxdoHWO$sW``?r XJS%QBuX+?$#yh+xhQJ4A3-JE}?NNaK literal 0 HcmV?d00001 diff --git a/Answers/target/classes/Rent.class b/Answers/target/classes/Rent.class new file mode 100644 index 0000000000000000000000000000000000000000..3457b04dbcc44f48dcefd9cc8816d68e0ef7f2f0 GIT binary patch literal 792 zcmZuu%Wl&^6g`tTZzoOLv^0T0d9)-hA{%z4T|k8t$qEvWY^zB+DlSeexen`oP!}K( zA+g{C`cYNSokSw4EX#B6+}Anx%+2lJe*li~vWyI}1voBp$Sc$@^bg$&_4K^=adctE zi9-HuFb$Gpg>0ugETM=}0c95zxC+iEGnJB26nzg29seD@L#e8{SVLW*IEdoO*Gm&C zxW4#0l$)*DaIuMoLP^Hx@U(xTp!(9i?cxD;6e`QinNB!<%eVBBU}AcHG}hq>!-on7 zodxdd{C;X}cSzFjqcaX$^Mk1w%qAlff6=3mkqtX@sN+EH%b=5d3od0dVM46Rxk>)7 zRO@tCLAeUkqJgMUWYX%v)frw{l2Y~+%AccIJT@N!0k;~wmi_RQ0%Z6+4u8tb6QZTH z)XQ3`L+e2C-I_dGyj`&?N89rLKzRpq6ueh+RK4~b>t55DW9t{Q89bC4kKzm~invepwm!sZEfmuz~pQlImFqxzH10yuAj mbqlf>m|KD>r>0#Cs_9!Dd(!*CEOY&P%FN9ia|y8BZ9)WbUR3hr?d z|DHrA^{)!5Avc>Iwxo^sqc=>VlVmbzOFQ3RZq!&#Ra>0=W%!Ge*PC$?9cuW`u-(^O zhMlnA3P-V=XGt^d#bYXJ3hjLbryHer)C+!fc>syA-~nrHpuyz$QPTA5!o;0CP**1< zLLbY@9t|g>PV_Aney&jXAp62wZo=SeWN5inMusd*d#;Dxg5p=8E%G#ArA1#1uAzdx zDV$(?id;}Or`WjCuo7)a7uhi3KtBU*0a-lbUBE0G;5o|l63JktBN;7pit;wBQ+R>O zY;=uYs;uA-oJ$4<#{jlY=5*`3HrA}Q!b`lGgN->jcd-C2tOUQtn;H1CUJt0Xa!#@L lGUW#b!8Rv~w30qMb7>B?xnZIGZl#QkMH!WqOm;Ni-CHj^dl~=$ literal 0 HcmV?d00001