Question: I could use some help on the below assignment. I am not sure how to complete this and could use some help, below the assignment
I could use some help on the below assignment.
I am not sure how to complete this and could use some help, below the assignment outline is the code I have so far.
I have not made the main for the menu yet. This assignment asks students to implement the library simulation system which has the following functions:
- Register a new customer to the library system
- Add a new book into the library database
- Remove the book from the library database
- Borrow the book
- Return the book
Add new Customer:
All customers must register prior to using this library. In order to register new customer, the new customer needs to the some information: name, phone, email, address, state. The customer ID will be assigned by the system when the new customer registers.
Whenever the user wants to use the library system, the system should check that this user has been registered or not.
Add new books:
All books should be loaded into the library database system prior to being used. In order to register new book, the following data should be entered: ISBN, title, author, publisher, Quantity.
Borrow Books:
- When a customer borrows the book, system needs to check the given customer is already registered through searching for the user list. If he/she is valid, borrowing the book is allowed.
- Librarian enters the book title or ISBN and quantity to be borrowed, system checks if the given book is in the library and also the quantity user asked is available. The quantity must be an unsigned integer.
- There is a borrow limit that each customer cannot borrow more than 5 books at one time.
Display Books:
Display all book information to the screen.
Remove Books:
Specific book will be entered and then deleted from the book database.
Return Books:
- When customer returns the book, system needs to check the customers borrow status. If he/she is valid, system put the book back to the library database.
Main menu options:
The main routine should be repeated until the user exits.
- Register a new user
- Borrow the book
- Return the book
- Add a new book to the library
- Remove the book from the library
- Display book list
- Exit the menu
Secure Variable rules:
- Declare your variables all on different lines
- Minimize Scopes
- Declare constants as static final
- Do not reuse variable names in sub-scopes
Data Validation rules:
- Customer name does not include any special symbols and the length is no more than 20 characters.
- Available states: MI, IL, OH, IN, MO, WI
- Email: starts with the recipient name (maximum of 8 characters long with alphabet, digits and special symbols), followed by symbol @ and domain name (maximum of 5 characters long with alphabet and digits), followed by period, and then top level domains (like com, net, org, or edu) will be followed.
- Book title includes any number of alphanumeric characters and the length is no more than 50 characters.
- Quantity should be the positive number.
- 10 digit ISBN number: To verify an ISBN, calculate 10 times the first digit, plus 9 times the second digit, plus 8 times the third digit and so on until we add 1 time the last digit. If the final number leaves no remainder when divided by 11, the code is a valid ISBN.
//book class here
import java.util.*;
public class Book {
Scanner in = new Scanner(System.in); private int IsbnNo; private String Author; private String Title; private String Condition; private int yearPublished; private String Status; private String publisher; private int stock;
public Book(int IsbnNo, String Author, String Title, String Condition, int yearPublished, String Status, String publisher, int stock) { this.IsbnNo = IsbnNo; this.Author = Author; this.Title = Title; this.Condition = Condition; this.yearPublished = yearPublished; this.Status = Status; this.publisher = publisher; this.stock = stock; }
public Book() { IsbnNo = 0; Author = ""; Title = ""; Condition = ""; yearPublished = 0; Status = ""; publisher = ""; stock = 0; }
public int getIsbnNo() { return IsbnNo; }
public void setIsbnNo(int IsbnNo) { this.IsbnNo = IsbnNo; }
public String getAuthor() { return Author; }
public void setAuthor(String Author) { this.Author = Author; }
public String getTitle() { return Title; }
public void setTitle(String Title) { this.Title = Title; }
public String getCondition() { return Condition; }
public void setCondition(String Condition) { this.Condition = Condition; }
public int getYearPublished() { return yearPublished; }
public void setYearPublished(int yearPublished) { this.yearPublished = yearPublished; }
public String getStatus() { return Status; }
public void setStatus(String Status) { this.Status = Status; }
public String getPublisher() { return publisher; }
public void setPublisher(String publisher) { this.publisher = publisher; }
public int getStock() { return stock; }
public void setStock(int stock) { this.stock = stock; }
private int returnBook(int isbnNumber) { System.out.println("Enter in the ISBN #: "); isbnNumber = in.nextInt(); if (isbnNumber == IsbnNo){ stock++; } else{ System.out.println("ISBN # doesnt match, Check again"); isbnNumber = in.nextInt(); stock++; } return stock; }
private void deleteBook() { }
private void getID() { }
@Override public String toString() { return "Book Information: " + "IsbnNo: " + IsbnNo + " " + "Author: " + Author +" " + "Title: " + Title +" " + "Condition: " + Condition + " " + "Year Published: " + yearPublished +" " + "Status: " + Status + " " + "Publisher:"+ publisher + " " + "Stock: " + stock; }
} //customer class here
import java.util.*;
public class Customer extends Book {
Scanner in = new Scanner(System.in); private String phoneNo; private String Name; private String Email; private String StateAb; private String Address; private int CustomerID; private int booksRented; private int booksLeft; private int newID;
public Customer(String phoneNo, String Name, String Email, String StateAb, String Address, int CustomerID, int booksRented, int booksLeft) { this.phoneNo = phoneNo; this.Name = Name; this.Email = Email; this.StateAb = StateAb; this.Address = Address; this.CustomerID = CustomerID; this.booksRented = booksRented; this.booksLeft = booksLeft; }
public Customer() { phoneNo = ""; Name = ""; Email = ""; StateAb = ""; Address = ""; CustomerID = 0; booksRented = 0; booksLeft = 0; }
public String getPhoneNo() { return phoneNo; }
public void setPhoneNo(String phoneNo) { this.phoneNo = phoneNo; }
public String getName() { return Name; }
public void setName(String Name) { this.Name = Name; }
public String getEmail() { return Email; }
public void setEmail(String Email) { this.Email = Email; }
public String getState() { return StateAb; }
public void setState(String StateAb) { this.StateAb = StateAb; }
public String getAddress() { return Address; }
public void setAddress(String Address) { this.Address = Address; }
public int getCustomerID() { return CustomerID; }
public void setCustomerID(int CustomerID) { this.CustomerID = CustomerID; }
public int getBooksRented() { return booksRented; }
public void setBooksRented(int booksRented) { this.booksRented = booksRented; }
public int getBooksLeft() { return booksLeft; }
public void setBooksLeft(int booksLeft) { this.booksLeft = booksLeft; }
private int newAccount() { if (StateAb == "MI" || StateAb == "IL" || StateAb == "OH" || StateAb == "IN" || StateAb == "MO" || StateAb == "WI") { System.out.println("Enter in a new ID"); newID = in.nextInt(); if (newID != CustomerID) {
} else { System.out.println("Id is already taken, create a new ID: "); newID = in.nextInt(); } } else { System.out.println("State is not valid for account:"); } return newID; } /// This method should print out books rented(title, isbnNo, Name and ID number) each rented book Booksleft(5)-- private static void rentedBooks() {
} // This method should take limit(5) minus booksleft and return value for limit(remaining books to rent) private static int Limit() { return 0; }
@Override public String toString() { return "Customer Account:" + " " + "Phone Number: " + phoneNo + " " + "Name: " + Name + " " + "Email Address" + Email + " " + "State: " + StateAb + " " + "Address: " + Address + " " + "CustomerID: " + CustomerID + " " + "Total Books Rented: " + booksRented + " " + "Books left to check out" + booksLeft; }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
