Subject Computer Science Java Programming

Question

Your task in this assignment is to design and implement a simple library system that allows admin users to insert, update and delete a new book, or search for a specific book among existing library's books, and display the books in a sorted order. Each book has an ISBN, title, and author's name (lastname, firstname). Insert and update operations should maintain the uniqueness property of the book ISBN. Assume the total number of books will not exceed 100. The program should be menu-driven similar to the following:

0. Exit
1. Insert a new book
2. Update an existing book
3. Search for a book (by ISBN, by title, by name)
4. Delete a book (by ISBN, by title, by name)
5. List all books (by ISBN, by title, by name)

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.ArrayList;
import java.util.Scanner;

/*
* LibrarySystem Class for maintaining library (aggregate of books).
*/
public class LibrarySystem {

/*
   * Book Class for maintaining individual books.
   * Book has three fields: ISBN, title, and name.
   */
public class Book {

    public int ISBN;
    public String title;
    public String name;
   
    public Book(int i,String t,String n) {
      ISBN = i;
      title = t;
      name = n;
    }

}

public ArrayList<Book> books;

//Constructor -- initialize empty array of Books
public LibrarySystem() {
    books = new ArrayList<Book>();
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats