From 277f58fb8e01f7246411112513c6db00e5b2c082 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:40:54 +0530 Subject: [PATCH 01/31] add fields to Book.java --- src/definitions/Book.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index a0f1b417..3fd7409f 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -7,4 +7,9 @@ package definitions; public class Book { + private String bookName; + private String authorName; + private String bookISBNNumber; + + } From 4de2bb40a44f31723aa8489e8a5c6af22dffb98e Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:41:28 +0530 Subject: [PATCH 02/31] add constructor method to Book.java --- src/definitions/Book.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index 3fd7409f..3a0df436 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -11,5 +11,11 @@ public class Book { private String authorName; private String bookISBNNumber; + public Book(String bookName, String authorName, String bookISBNNumber) { + this.bookName = bookName; + this.authorName = authorName; + this.bookISBNNumber = bookISBNNumber; + } + } From 38bdfdfaae85775561d090f1098c43f5fa0cc23d Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:42:25 +0530 Subject: [PATCH 03/31] add getter and setter methods for Book.bookName --- src/definitions/Book.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index 3a0df436..797611ff 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -17,5 +17,15 @@ public Book(String bookName, String authorName, String bookISBNNumber) { this.bookISBNNumber = bookISBNNumber; } + public String getBookName() { + + return bookName; + } + + public void setBookName(String bookName) { + + this.bookName = bookName; + } + } From 6d770972f132afee3e60aa4fe77a38d78167b7d1 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:43:07 +0530 Subject: [PATCH 04/31] add getter and setter methods for Book.authorName --- src/definitions/Book.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index 797611ff..ac681909 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -27,5 +27,15 @@ public void setBookName(String bookName) { this.bookName = bookName; } + public String getAuthorName() { + + return authorName; + } + + public void setAuthorName(String authorName) { + + this.authorName = authorName; + } + } From 4e0b869a43520e275fa4b7d82801c3edf11fea73 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:43:42 +0530 Subject: [PATCH 05/31] add getter and setter methods for Book.bookISBNNumber --- src/definitions/Book.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index ac681909..4bc558ee 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -37,5 +37,15 @@ public void setAuthorName(String authorName) { this.authorName = authorName; } + public String getIsbnNumber() { + + return bookISBNNumber; + } + + public void setIsbnNumber(String bookISBNNumber) { + + this.bookISBNNumber = bookISBNNumber; + } + } From bb859871929da420ff3b8a8caa5ffd44aa4c82c0 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:44:24 +0530 Subject: [PATCH 06/31] add the toString() method to Book.java --- src/definitions/Book.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index 4bc558ee..81d4bbe3 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -47,5 +47,12 @@ public void setIsbnNumber(String bookISBNNumber) { this.bookISBNNumber = bookISBNNumber; } + public String toString() { + return String.format( + "Book Name: %s, Author Name: %s, ISBN Number: %s", + getBookName(), getAuthorName(), getIsbnNumber() + ); + } + } From a9a0a0e601b9167eee6299258df9453e8e78d0e9 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 11:45:49 +0530 Subject: [PATCH 07/31] add the equals() method and hashcode() method to Book.java --- src/definitions/Book.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index 81d4bbe3..ef70844a 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -6,6 +6,10 @@ * */ package definitions; +import java.util.Objects; + +import java.lang.String; + public class Book { private String bookName; private String authorName; @@ -54,5 +58,20 @@ public String toString() { ); } + @Override + public boolean equals (Object o){ + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Book book = (Book) o; + return Objects.equals(getBookName(), book.getBookName()) && + Objects.equals(getAuthorName(), book.getAuthorName()) && + Objects.equals(getIsbnNumber(), book.getIsbnNumber()); + } + + @Override + public int hashCode () { + return Objects.hash(getBookName(), getAuthorName(), getIsbnNumber()); + } + } From 527877378b6f7da8d04a439b3c4d0cfcaa4316a0 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:45:19 +0530 Subject: [PATCH 08/31] add fields to Library.java --- src/definitions/Book.java | 2 +- src/definitions/Library.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index ef70844a..c3630db8 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -1,5 +1,5 @@ /* Created by IntelliJ IDEA. - * User: Divyansh Bhardwaj (dbc2201) + * User: Md. Faraaz Siddiqui (faraaz0) * Date: 21/08/20 * Time: 3:49 PM * File Name : Book.java diff --git a/src/definitions/Library.java b/src/definitions/Library.java index 0c55b5a1..79321f18 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -6,5 +6,11 @@ * */ package definitions; +import java.util.Arrays; + +import java.lang.String; + public class Library { + private Book[] books ; + } From 3a30b3a583619b7d57f0412d6f64d93a664cd144 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:46:01 +0530 Subject: [PATCH 09/31] add constructor method to Library.java --- src/definitions/Library.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index 79321f18..fdc9de20 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -13,4 +13,9 @@ public class Library { private Book[] books ; + public Library() { + + this.books = new Book[1000]; + } + } From dc2dcb0390d9c19177d4eb584c398d3953565170 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:47:17 +0530 Subject: [PATCH 10/31] add getter and setter methods to Library.java --- src/definitions/Library.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index fdc9de20..6c86da0d 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -18,4 +18,14 @@ public Library() { this.books = new Book[1000]; } + public Book[] getBooks() { + + return books; + } + + public void setBooks(Book[] books) { + + this.books = books; + } + } From 0c03341150ffe1920303571de9e4c10133cb32b6 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:48:12 +0530 Subject: [PATCH 11/31] create a method to add a returned book to Library.java --- src/definitions/Library.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index 6c86da0d..e5997dc8 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -28,4 +28,8 @@ public void setBooks(Book[] books) { this.books = books; } + public void addReturnedBook(String bookName){ + System.out.println(bookName + " has been successfully returned."); + } + } From c9b0af6428d437f38f517fbef3dcc518171a6828 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:49:25 +0530 Subject: [PATCH 12/31] add a toString() method to Library.java --- src/definitions/Library.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index e5997dc8..0cc5dab3 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -6,10 +6,6 @@ * */ package definitions; -import java.util.Arrays; - -import java.lang.String; - public class Library { private Book[] books ; @@ -28,8 +24,13 @@ public void setBooks(Book[] books) { this.books = books; } - public void addReturnedBook(String bookName){ + public void addReturnedBook(String bookName) { System.out.println(bookName + " has been successfully returned."); } + public String toString() { + return String.format( + "Books List: %s", getBooks()); + } + } From 91d8d0abec359fb4e03a5edaeb9bb7a693914635 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:51:06 +0530 Subject: [PATCH 13/31] add the equals() and hashcode() method to Library.java --- src/definitions/Library.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index 0cc5dab3..e0afa414 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -6,8 +6,10 @@ * */ package definitions; +import java.util.Arrays; + public class Library { - private Book[] books ; + private Book[] books; public Library() { @@ -33,4 +35,19 @@ public String toString() { "Books List: %s", getBooks()); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Library library = (Library) o; + return Arrays.equals(getBooks(), library.getBooks()); + } + + @Override + public int hashCode() { + + return Arrays.hashCode(getBooks()); + } + + } From 257f62a51e4e769595fcd0d9ba15cea372b9c74d Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:54:22 +0530 Subject: [PATCH 14/31] add private fields to Student.java --- src/definitions/Book.java | 3 +-- src/definitions/Library.java | 3 ++- src/definitions/Student.java | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/definitions/Book.java b/src/definitions/Book.java index c3630db8..124ff088 100644 --- a/src/definitions/Book.java +++ b/src/definitions/Book.java @@ -8,8 +8,6 @@ import java.util.Objects; -import java.lang.String; - public class Book { private String bookName; private String authorName; @@ -51,6 +49,7 @@ public void setIsbnNumber(String bookISBNNumber) { this.bookISBNNumber = bookISBNNumber; } + @Override public String toString() { return String.format( "Book Name: %s, Author Name: %s, ISBN Number: %s", diff --git a/src/definitions/Library.java b/src/definitions/Library.java index e0afa414..e49e9f8f 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -1,5 +1,5 @@ /* Created by IntelliJ IDEA. - * User: Divyansh Bhardwaj (dbc2201) + * User: Md. Faraaz Siddiqui (faraaz0) * Date: 21/08/20 * Time: 3:50 PM * File Name : Library.java @@ -30,6 +30,7 @@ public void addReturnedBook(String bookName) { System.out.println(bookName + " has been successfully returned."); } + @Override public String toString() { return String.format( "Books List: %s", getBooks()); diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 4be682cb..1324e1fe 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -7,4 +7,8 @@ package definitions; public class Student { + private String[] nameOfTheStudent; + private long universityRollNumber; + private int numberOfBooksIssued; + private Book[] books; } From 314297db6a04ebb11aa659e74ab712169f80bf36 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:54:57 +0530 Subject: [PATCH 15/31] add constructor method to Student.java --- src/definitions/Student.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 1324e1fe..6b52061e 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -11,4 +11,11 @@ public class Student { private long universityRollNumber; private int numberOfBooksIssued; private Book[] books; + + public Student(String nameOfTheStudent, long universityRollNumber, int numberOfBooksIssued) { + this.nameOfTheStudent = nameOfTheStudent.split(" "); + this.universityRollNumber = universityRollNumber; + this.numberOfBooksIssued = numberOfBooksIssued; + this.books = new Book[numberOfBooksIssued]; + } } From f4c5cda0008c0aca14c77ef4a2361f724cc33a7c Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:56:03 +0530 Subject: [PATCH 16/31] add getter and setter methods for nameOfTheStudent. --- src/definitions/Student.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 6b52061e..8bfb926c 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -18,4 +18,14 @@ public Student(String nameOfTheStudent, long universityRollNumber, int numberOfB this.numberOfBooksIssued = numberOfBooksIssued; this.books = new Book[numberOfBooksIssued]; } + + public String[] getNameOfTheStudent() { + + return nameOfTheStudent; + } + + public void setNameOfTheStudent(String[] nameOfTheStudent) { + + this.nameOfTheStudent = nameOfTheStudent; + } } From 3715a7d3a8d43a24c04a3057a140f0931f0b9f4e Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:56:50 +0530 Subject: [PATCH 17/31] add getter and setter methods for universityRollNumber --- src/definitions/Student.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 8bfb926c..e3c76a0f 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -28,4 +28,14 @@ public void setNameOfTheStudent(String[] nameOfTheStudent) { this.nameOfTheStudent = nameOfTheStudent; } + + public long getUniversityRollNumber() { + + return universityRollNumber; + } + + public void setUniversityRollNumber(long universityRollNumber) { + + this.universityRollNumber = universityRollNumber; + } } From 749f79fb30a85104092acb89850ef3ceedb64d58 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:57:36 +0530 Subject: [PATCH 18/31] add getter and setter methods for numberOfBooksIssued --- src/definitions/Student.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index e3c76a0f..e1ad6ca8 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -38,4 +38,14 @@ public void setUniversityRollNumber(long universityRollNumber) { this.universityRollNumber = universityRollNumber; } + + public int getNumberOfBooksIssued() { + + return numberOfBooksIssued; + } + + public void setNumberOfBooksIssued(int numberOfBooksIssued) { + + this.numberOfBooksIssued = numberOfBooksIssued; + } } From ea4b8082a7201c70bee7629a225ab20c98bce0de Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 12:58:16 +0530 Subject: [PATCH 19/31] add getter and setter methods for Books --- src/definitions/Student.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index e1ad6ca8..0846ba52 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -48,4 +48,12 @@ public void setNumberOfBooksIssued(int numberOfBooksIssued) { this.numberOfBooksIssued = numberOfBooksIssued; } + + public Book[] getBooks() { + return books; + } + + public void setBooks(Book[] books) { + this.books = books; + } } From f4f580b0a3fe4e0f53d1472c04d1b4024b5a81d2 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 13:00:05 +0530 Subject: [PATCH 20/31] create a method to add an issued book to Student.java --- src/definitions/Student.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 0846ba52..619777c3 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -56,4 +56,8 @@ public Book[] getBooks() { public void setBooks(Book[] books) { this.books = books; } + + public void addNewBook(String bookName) { + System.out.println(bookName + " has been successfully issued."); + } } From 3536986466bff2e451b49aea88659586ab6873a2 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 13:01:50 +0530 Subject: [PATCH 21/31] create a method to show all my issued books. --- src/definitions/Student.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 619777c3..a96094e6 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -60,4 +60,10 @@ public void setBooks(Book[] books) { public void addNewBook(String bookName) { System.out.println(bookName + " has been successfully issued."); } + + public void myIssuedBooks() { + for (Book books : books) { + System.out.println(books); + } + } } From 93231a140fd0536934778ac9de81e121bcb1dc3d Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 13:04:09 +0530 Subject: [PATCH 22/31] add the toString() method to Student.java --- src/definitions/Student.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index a96094e6..6d02a939 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -66,4 +66,12 @@ public void myIssuedBooks() { System.out.println(books); } } + + @Override + public String toString() { + return String.format( + "Student Name: %s, University Roll Number: %l, Number Of Books Issued: %d, Name Of Books Issued By The Student: %d", + getNameOfTheStudent(), getUniversityRollNumber(), getNumberOfBooksIssued(), getBooks() + ); + } } From 3fbda2a210915936666fda09999bf197cfc2b7ac Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 13:05:48 +0530 Subject: [PATCH 23/31] add the equals() and the hashcode() method to Student.java --- src/definitions/Student.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 6d02a939..8e2a1cf6 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -6,6 +6,10 @@ * */ package definitions; +import java.util.Arrays; +import java.util.Objects; + + public class Student { private String[] nameOfTheStudent; private long universityRollNumber; @@ -74,4 +78,23 @@ public String toString() { getNameOfTheStudent(), getUniversityRollNumber(), getNumberOfBooksIssued(), getBooks() ); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Student student = (Student) o; + return getUniversityRollNumber() == student.getUniversityRollNumber() && + getNumberOfBooksIssued() == student.getNumberOfBooksIssued() && + Arrays.equals(getNameOfTheStudent(), student.getNameOfTheStudent()) && + Arrays.equals(getBooks(), student.getBooks()); + } + + @Override + public int hashCode() { + int result = Objects.hash(getUniversityRollNumber(), getNumberOfBooksIssued()); + result = 31 * result + Arrays.hashCode(getNameOfTheStudent()); + result = 31 * result + Arrays.hashCode(getBooks()); + return result; + } } From 7d0896f6295fa64484da6f94d23a83357091bf7e Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 18:34:03 +0530 Subject: [PATCH 24/31] add private fields to FrontDesk.java --- src/execution/FrontDesk.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/execution/FrontDesk.java b/src/execution/FrontDesk.java index e0ebd741..84969c3b 100644 --- a/src/execution/FrontDesk.java +++ b/src/execution/FrontDesk.java @@ -7,6 +7,11 @@ package execution; public class FrontDesk { + private static final int ADD_NEW_BOOK = 1; + private static final int RETURN_BOOK = 2; + private static final int MY_ISSUED_BOOKS = 3; + private static final int EXIT = 4; + public static void main(String[] args) { } From 07d99c7f9035200d14ba19c05bd7bd85144270d5 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 18:35:32 +0530 Subject: [PATCH 25/31] create a scanner object --- src/execution/FrontDesk.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/execution/FrontDesk.java b/src/execution/FrontDesk.java index 84969c3b..507e5fda 100644 --- a/src/execution/FrontDesk.java +++ b/src/execution/FrontDesk.java @@ -6,6 +6,8 @@ * */ package execution; +import java.util.Scanner; + public class FrontDesk { private static final int ADD_NEW_BOOK = 1; private static final int RETURN_BOOK = 2; @@ -13,6 +15,7 @@ public class FrontDesk { private static final int EXIT = 4; public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); } } From 4b871e747226b1a91230959e84f08119262cb14c Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 18:36:05 +0530 Subject: [PATCH 26/31] take input from user. --- src/execution/FrontDesk.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/execution/FrontDesk.java b/src/execution/FrontDesk.java index 507e5fda..ce25c4bf 100644 --- a/src/execution/FrontDesk.java +++ b/src/execution/FrontDesk.java @@ -16,6 +16,7 @@ public class FrontDesk { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); + int userInput; } } From a13d0decc27fb7f39fab6d4b55b59be699fff4a4 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 18:37:02 +0530 Subject: [PATCH 27/31] create a Student object and add some values to it. --- src/execution/FrontDesk.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/execution/FrontDesk.java b/src/execution/FrontDesk.java index ce25c4bf..19c9690d 100644 --- a/src/execution/FrontDesk.java +++ b/src/execution/FrontDesk.java @@ -6,6 +6,8 @@ * */ package execution; +import definitions.Student; + import java.util.Scanner; public class FrontDesk { @@ -17,6 +19,7 @@ public class FrontDesk { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int userInput; + Student student = new Student("Md Faraaz Siddiqui", 191500454, 3); } } From ac99c9d841ab15b2057162097af562e310e16a39 Mon Sep 17 00:00:00 2001 From: faraaz0 Date: Fri, 28 Aug 2020 18:48:44 +0530 Subject: [PATCH 28/31] create a menu as given in the problem statement and call the respective methods. --- src/definitions/Library.java | 3 --- src/definitions/Student.java | 4 ++++ src/execution/FrontDesk.java | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/definitions/Library.java b/src/definitions/Library.java index e49e9f8f..c8d10e7e 100644 --- a/src/definitions/Library.java +++ b/src/definitions/Library.java @@ -26,9 +26,6 @@ public void setBooks(Book[] books) { this.books = books; } - public void addReturnedBook(String bookName) { - System.out.println(bookName + " has been successfully returned."); - } @Override public String toString() { diff --git a/src/definitions/Student.java b/src/definitions/Student.java index 8e2a1cf6..632212c7 100644 --- a/src/definitions/Student.java +++ b/src/definitions/Student.java @@ -71,6 +71,10 @@ public void myIssuedBooks() { } } + public void returnAnIssuedBook(String bookName) { + System.out.println(bookName + " has been successfully returned."); + } + @Override public String toString() { return String.format( diff --git a/src/execution/FrontDesk.java b/src/execution/FrontDesk.java index 19c9690d..7c13bde4 100644 --- a/src/execution/FrontDesk.java +++ b/src/execution/FrontDesk.java @@ -20,6 +20,48 @@ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int userInput; Student student = new Student("Md Faraaz Siddiqui", 191500454, 3); + do { + System.out.println("-=-=--=-=-Welcome To The Front Desk-=-=--=-=-"); + System.out.println("How may I help you today?"); + System.out.println("1. Issue a new book for me: "); + System.out.println("2. Return a previously issued book for me: "); + System.out.println("3. Show me all my issued books: "); + System.out.println("4. Exit."); + System.out.println("Enter your choice (1..4): "); + userInput = scanner.nextInt(); + switch (userInput) { + case ADD_NEW_BOOK: + System.out.println("Enter the name of the book you want to read: "); + scanner.nextLine(); + String bookName = scanner.nextLine(); + student.addNewBook(bookName); + break; + + case RETURN_BOOK: + System.out.println("Enter the name of the book you want to return: "); + scanner.nextLine(); + bookName = scanner.nextLine(); + student.returnAnIssuedBook(bookName); + break; + + case MY_ISSUED_BOOKS: + student.myIssuedBooks(); + break; + default: + System.out.println("WRONG CHOICE!"); + } + } + + while (userInput != EXIT); + { + scanner.close(); + } + } } + + + + + From 16369115dec0ed648ba0bd2e5e0c74832ac6f691 Mon Sep 17 00:00:00 2001 From: "Md. Faraaz Siddiqui" <61276287+faraaz0@users.noreply.github.com> Date: Thu, 1 Oct 2020 13:03:28 +0530 Subject: [PATCH 29/31] Updated your README file. I've added some necessary points in your README file. --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21a6a336..88167c5b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,10 @@ Every good university/college has a well-stocked library for the students. The students get access to a wide variety of literature on topics/subjects that are crucial for their personal as well as professional development. But as the number of students using the library increases, the task of keeping records get very difficult. In this assignment, we - are going to simulate that task by writing a piece of software. + are going to simulate that task by writing a piece of software. + < In this software we'll create some definition classes and execution classes. + < We'll create as many objects as we can to improve the functioning of our Library. + < We'll then call these objects in the execution classes to make a better library. @@ -65,4 +68,5 @@ Since this is the first assignment, feel free to add as many methods as you can, of a field, and a method; the name of a field should be a noun, and the name of a method should be a verb! It is completely alright if you cannot implement the actual code for the methods, you can simple write a print -statement to represent that the methods are working, just like in the `Video Rental Inventory System` project. \ No newline at end of file +statement to represent that the methods are working, just like in the `Video Rental Inventory System` project. +* Author - Naman Agarwal From d9d3eac461697d4fe992668562c6c3f72a0b1310 Mon Sep 17 00:00:00 2001 From: "Md. Faraaz Siddiqui" <61276287+faraaz0@users.noreply.github.com> Date: Thu, 1 Oct 2020 13:04:20 +0530 Subject: [PATCH 30/31] Re - revised your README file. Updated by - Faraaz --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 88167c5b..f0231546 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ Every good university/college has a well-stocked library for the students. The s literature on topics/subjects that are crucial for their personal as well as professional development. But as the number of students using the library increases, the task of keeping records get very difficult. In this assignment, we are going to simulate that task by writing a piece of software. - < In this software we'll create some definition classes and execution classes. - < We'll create as many objects as we can to improve the functioning of our Library. - < We'll then call these objects in the execution classes to make a better library. + Date: Thu, 1 Oct 2020 13:05:11 +0530 Subject: [PATCH 31/31] Re - revised your README file. Updated by Faraaz --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0231546..b1355152 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ Every good university/college has a well-stocked library for the students. The s literature on topics/subjects that are crucial for their personal as well as professional development. But as the number of students using the library increases, the task of keeping records get very difficult. In this assignment, we are going to simulate that task by writing a piece of software. -