Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Book Management system with Java Code

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report