JAVA JAVA Programing You will be writing a Library book keeping system which stores its information in a database. Set Up Apache Derby You will need to download Apache Derby XXXXXXXXXX...

1 answer below »
java code data are provide please provide ALL the screen shot and read it carefully




JAVA JAVA Programing You will be writing a Library book keeping system which stores its information in a database. Set Up Apache Derby You will need to download Apache Derby 10.15.2.0 (https://db.apache.org/derby/releases/release-10_15_2_0.cgi) and add it to your IntelliJ classpath (https://www.jetbrains.com/help/idea/working-with-module-dependencies.html) You will only require the "lib" distribution and only the derby.jar file within the lib directory. You need to provide a JDBC Connection String. For Apache Derby, you will use the following connection string to pass to DriverManager#getConnection: // Create a Derby database called "library" and that only exists in memory // Every time the application is terminated, the database will be lost String connectionURL = "jdbc:derby:memory:library;create=true"; When creating tables (https://www.w3schools.com/sql/sql_create_table.asp), you will need to specify the data type (https://db.apache.org/derby/docs/10.7/ref/crefsqlj31068.html) for each column in the table. In particular, check out varchar. Universally Unique Identifier A universally unique identifier (UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier)) is a 128-bit label used for information in computer systems. They are often used as an identifier to assign to records when there cannot be a single sequence number generated. Consider if several computers are all generating messages and each message needs to be identifiable. Each message could be assigned a randomly generated UUID with a high confidence level that no two will have the same ID. This can be performed independent of each other and independent of a central ID management system. This will be useful when assigning ID values to members of the library as several members may have the same first and last names and therefore cannot be uniquely identified. https://db.apache.org/derby/releases/release-10_15_2_0.cgi https://db.apache.org/derby/releases/release-10_15_2_0.cgi https://www.jetbrains.com/help/idea/working-with-module-dependencies.html https://www.jetbrains.com/help/idea/working-with-module-dependencies.html https://www.w3schools.com/sql/sql_create_table.asp https://db.apache.org/derby/docs/10.7/ref/crefsqlj31068.html https://en.wikipedia.org/wiki/Universally_unique_identifier https://en.wikipedia.org/wiki/Universally_unique_identifier UUIDs are so prevalent in the computer world that Java provides it own API (https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/UUID.html) for generating and working with UUIDs. The Assignment The Overview For this assignment, your Library system will have the following classes: ● Library.java - The main entry point of your application ● Member.java - A class representing a library's member ● Book.java - A class representing a book available within the library ● LibraryService.java - The class responsible for checking in and checking out books to members ● MemberService.java - Member CRUD operations ● BookService.java - Book CRUD operations The Domain A Member of the library has the following attributes: 1. A unique ID (String) 2. First name 3. Last name 4. Street address 5. Phone number (String) A Book of the library has the following attributes: 1. A unique ID (String - ISBN (https://en.wikipedia.org/wiki/International_Standard_Book_Number)) 2. Title 3. Author 4. Genre https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/UUID.html https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/UUID.html https://en.wikipedia.org/wiki/International_Standard_Book_Number https://en.wikipedia.org/wiki/International_Standard_Book_Number The Services For each service, ensure that its constructor accepts a Connection and creates its supporting table. The BookService has the following methods: 1. public Book getByIsbn(final String isbn) 2. public Collection getByAuthor(final String author) 3. public Collection getByGenre(String author) 4. public Book createBook(Book book) // create book based on ISBN of book 5. public void updateBook(Book book) // update book based on ISBN of book 6. public void deleteBook(Book book) // delete book based on ISBN of book The MemberService has the following methods: 1. public Member getById(final String id) 2. public Member getByPhoneNumber(final String phoneNumber) 3. public Collection getByLastName(final String lastName) 4. public Member createMember(Member member) // create member based on ID of member 5. public Member updateMember(Member member) // update member based on ID of member 6. public void deleteMember(Member member) // delete member based on ID of member The LibraryService has the following methods: 1. public boolean borrowBook(Member member, Book book) // returns true if member was able to borrow book - false otherwise 2. public void returnBook(Member member, Book book) 3. public Collection getBooks(Member member) Note: A member is only allowed to borrow a book if that member has 3 or fewer books already borrowed The Data public static Collection getBooks() { return Arrays.asList( new Book("0-7475-3269-9", "Harry Potter and the Philosopher's Stone", "J.K. Rowling", "Fantasy"), new Book("0-545-01022-5", "Harry Potter and the Deathly Hallows", "J.K. Rowling", "Fantasy"), new Book("978-0553213119", "Moby Dick", "Herman Melville", "Fiction"), new Book("978-0446310789", "To Kill a Mockingbird", "Harper Lee", "Fiction"), new Book("978-0486280615", "The Adventures of Huckleberry Finn", "Mark Twain", "Fiction"), new Book("978-0743273565", "The Great Gatsby", "F. Scott Fitzgerald", "Fiction"), new Book("978-1604596342", "The Education of Henry Adams", "Henry Adams", "Non-Fiction")); } public static Collection getMembers() { return Arrays.asList( new Member(UUID.randomUUID().toString(), "John", "Doe", "123 Maple Street", "987-654-3210"), new Member(UUID.randomUUID().toString(), "Jane", "Doe", "123 Maple Street", "987-654-3211"), new Member(UUID.randomUUID().toString(), "Dr.", "Evil", "47 Diabolical Way", "547-842-5468"), new Member(UUID.randomUUID().toString(), "Sir", "Lancelot", "1372 Joyous Gard Road", "834-879-4973")); } The Testing Write a series of test within Library.java in order to test the functionality of each method in all services. The Submission Submit the following: 1. All 6 classes 1. Library.java 2. Member.java 3. Book.java 4. LibraryService.java 5. MemberService.java 6. BookService.java With all the screenshot The data are provide up To get you started, allow me to provide you my solution for deleting a book object. public void deleteBook(Book book) throws SQLException { final String select = "DELETE FROM BOOK WHERE ISBN=?"; try (PreparedStatement statement = conn.prepareStatement(select)) { statement.setString(1, book.getIsbn()); statement.execute(); } }
Answered 1 days AfterDec 04, 2021

Answer To: JAVA JAVA Programing You will be writing a Library book keeping system which stores its information...

Kondalarao answered on Dec 05 2021
127 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here