Project on Library System
package BOOk;
public class Book {
private String name;
private String author;
private double price;
private int store;
private String publishDate;
public Book(String name, String author, double price, int store, String
publishDate) {
[Link] = name;
[Link] = author;
[Link] = price;
[Link] = store;
[Link] = publishDate;
}
public Book() {
super();
// TODO Auto-generated constructor stub
public String getName() {
return name;
public void setName(String name) {
[Link] = name;
public String getAuthor() {
return author;
public void setAuthor(String author) {
[Link] = author;
public double getPrice() {
return price;
}
public void setPrice(double price) {
[Link] = price;
public int getStore() {
return store;
public void setStore(int store) {
[Link] = store;
public String getPublishDate() {
return publishDate;
public void setPublishDate(String publishDate) {
[Link] = publishDate;
public void add(){
}
package BOOk;
import [Link];
public class newBook {
public static void main(String[] args) {
[Link]("Welcome to the Bookstore");
[Link]("Please enter username:");
Scanner input = new Scanner([Link]);
String userName = [Link]();
String trueUserNamer = "admin";
[Link]("Please enter password:");
String mima = [Link]();
String password = "admin";
if (([Link](trueUserNamer)) && ([Link](password)))
[Link]("Login Success");
else
[Link]("Login failed");
Book[] book = new Book[5];
Book b1 = new Book ("Ghost Blowing Light", "World Singer", 33,
6, "2004-2-12");
Book b2 = new Book ("Devil World", "Morse", 45, 4, "2001-1-1");
Book b3 = new Book ("Time Machine", "Will", 64, 5, "2000-1-22");
Book b4 = new Book("Harry Potter", " ", 12, 3, "1998-4-12");
Book b5 = new Book("No", "No", 0, 0, "No");
book[0] = b1;
book[1] = b2;
book[2] = b3;
book[3] = b4;
book[4] =b5;
do {
[Link]("~~~~~~~~ Welcome to the library
management system~~~~~~~~");
[Link]("\[Link] Books");
[Link]("\[Link] in the library");
[Link]("\[Link] Outbound");
[Link]("\[Link] a book");
[Link]("\[Link]");
[Link]("Please do your operation");
int num = [Link]();
switch (num) {
Case 1:// query
[Link]("title\t author\t price\t
inventory\t publication date");
for (int i = 0; i < [Link]; i++) {
Book b = book[i];
[Link]([Link]() + "\t" +
[Link]() + "\t" + [Link]() + "\t" + [Link]()
+ "\t" +
[Link]());
break;
case 2:
// Book storage;
[Link]("Please enter the title");
String name = [Link]();
If ([Link](" ") || [Link](" ") ||
[Link]("Harry Potter") || [Link]("Time Machine"))
[Link]("Please enter to
increase inventory");
int store = [Link]();
for (int i = 0; i <= [Link]; i++) {
if ([Link](book[i].getName())) {
book[i].setStore(book[i].getStore() + store);
break;
break;
Case 3:// out of the library
[Link]("Please enter the title");
String name1 = [Link]();
If ([Link](" ") || [Link](" ") ||
[Link]("Harry Potter") || [Link]("Time Machine"))
[Link]("Please enter the
quantity to borrow");
int store1 = [Link]();
for (int i = 0; i <= [Link]; i++) {
if ([Link](book[i].getName())) {
book[i].setStore(book[i].getStore() - store1);
break;
break;
case 4:
[Link]("Please enter the title");
String name2=[Link]();
[Link]("Please enter the author");
String author2=[Link]();
[Link]("Please enter the price");
double price2=[Link]();
[Link]("Please enter the stock");
int store2=[Link]();
[Link]("Please enter the publication
date");
String publicDate=[Link]();
[Link](name2);[Link](author2);[Link](price2);[Link](store2);
[Link](publicDate);
break;
case 5:
return;
} while (true);
output of the program