How to realize the Book Management system with Java Code
This article mainly introduces "how to use Java code to achieve the book management system". In the daily operation, I believe that many people have doubts about how to use Java code to achieve the book management system. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to use Java code to achieve the library management system". Next, please follow the editor to study!
File location
AllBook
Package tushuguan;import java.io.Serializable;import java.util.Scanner;//---- Book Information Code-@ SuppressWarnings ("serial") class Book implements Serializable {/ / Book Class String BookNo; / / No. String BookName / / title String BookAuthor; / / author int zk; / / whether it is in the library int cs; / / number of times borrowed showInfo info=new showInfo () / / Daily display of borrowing information public Book () {/ / define construction method, initialize data items BookNo= "; BookName="; BookAuthor="; zk=0; cs=0;} public String getBookNo () {return BookNo } public String getBookName () {return BookName;} public String getBookAuthor () {return BookAuthor;} / / ````New Book Information ``public void inputBook () {/ / enter a single book @ SuppressWarnings ({"resource"}) Scanner in2=new Scanner (System.in) System.out.print ("Please enter the book number:"); String s; s=in2.nextLine (); int a; a=AllBook.queryBooByBookNo (s); while (await copyright 1) {/ / determine whether a book with the same number already exists System.out.print ("the book already exists, please re-enter it!\ n") System.out.print ("Please enter Book number:"); s=in2.nextLine (); a=AllBook.queryBooByBookNo (s);} BookNo=s; System.out.print ("Please enter Book name:"); BookName=in2.nextLine (); System.out.print ("Please enter Book author:"); BookAuthor=in2.nextLine (); zk=1 } public void showBook () {/ / display individual book information System.out.print ("Book number:" + BookNo+ "\ nBook name:" + BookName+ "\ nBook author:" + BookAuthor+ "\ nLending times:" + cs); if (zk==1) System.out.print ("\ nThe book: in the library\ n") Else System.out.print ("\ nThe book: not in the library\ n");} @ SuppressWarnings ("serial") public class AllBook implements Serializable {/ / all book collection classes static Book [] Book=new Book [20]; / / define an array object static int index=0 that can store 20 books / / used to store the number of existing books public AllBook () {/ / initialize the book information of all units For (int iTuno Bandi)