How to realize simple Book Lending system by Java
This article mainly introduces the relevant knowledge of "how to achieve a simple book lending system in Java". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to achieve a simple book lending system in Java" can help you solve the problem.
Develop a book lending system for the book reading room, which can save up to 50 books to realize the management of books. The book lending system has the following main functions.
U function
Lend out the ranking list
New books
View Books
Delete a book
Lend books
Return the book
Quit
Package com.daiinfo.seninorjava.ken8.implentment.utils;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Scanner;public class Bookborrowing {public static void main (String [] args) {int [] states=new int [50]; / Book Lending status 0: lent out, 1: available int [] counts=new int [50]; / / number of Book Lending String [] name=new String [50] / / Book name String [] dates=new String [50]; / / Book date / / initialize Book states [0] = 0; counts [0] = 15; name [0] = "data structure"; dates [0] = "2018-7-15"; states [1] = 1; counts [1] = 12; name [1] = "Database" Dates [1] = null; states [2] = 2; counts [2] = 30; name [2] = "discrete mathematics"; dates [2] = null; / / appearance interface Scanner input=new Scanner (System.in); int num=-1;// user enters 0 to return to the main menu boolean flage=false / / record whether the user exits the system, true: quit, false: do not quit do {System.out.println ("* *"); System.out.println ("1, add books"); System.out.println ("2, view books") System.out.println (3, delete books); System.out.println (4, lend books); System.out.println (5, return books); System.out.println (6, quit); int choose=input.nextInt (); switch (choose) {case 0: int number=0 For (; name [number]! = null;number++) {} / / find the total number of current titles int [] sortBook=new int [number]; printBook (name,counts,number,sortBook); break Case 1: System.out.println ("- > add Books"); int astat0; for (; a