In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
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 the example analysis of JAVA library management system, which is very detailed and has certain reference value. Friends who are interested must finish it!
Project description:
The function of the system is divided into reader information management module, book information management module, book lending management module, basic information maintenance module and user management module.
Reader information management: be able to manage the basic information of readers, including new readers, such as a new teacher in the school, if you want to borrow books, you must first add reader information; the modification of reader information, such as students transferred to other majors, at this time to modify the basic information of students; delete the reader's information, such as a student dropped out of school, his information can be deleted. Query the reader's information, for example, a student picked up a loan card, the card has the student's number, through this number to query the student's contact number, so that the student can be found.
Book information management: can manage the basic information of books, including new books, the school will buy new books every year, at this time, the information of new books needs to be entered into the system; the modification of book information, such as students lose books after borrowing books, the total number of books needs to be modified so that the total number of books is reduced by 1. Delete books, schools in the purchase of new books at the same time, every year to clean up expired books, no longer provide lending, at this time the information of these books need to be deleted from the system. Query information about books, such as books that are Java-related or books with a specified ISBN number, etc.
Book lending information management: can record the borrowing information of books, including reader information, book information, borrowing time and other information.
Book return information management: can record the borrowing information of books, including reader information, book information, return time, whether overdue, fine and other information.
System user information management: can manage the information of system users, including adding new system operation users, changing the password of current system users, and deleting a certain user.
The functions of the project are as follows:
(1) Reader information management: including the functions of reader information addition and reader information query and modification. After logging in successfully, users can browse the information of all readers or retrieve the information of specific readers; at the same time, the information of readers can be maintained, including adding, deleting and modifying. Specific information includes the type of reader (the type of reader determines the maximum number of books he can borrow and the maximum number of days he can return), the reader's name, date of birth, gender, telephone number, department, registration date, etc. (the relevant stored data can be stored in the file directly through the Istroke O stream, but can also be read directly in the file)
(2) Book information management: including the functions of book information addition and book information query and modification. After logging in successfully, users can browse all the book information and retrieve the information of specific books; they can also maintain the book information. This includes adding books, deleting books, and modifying book information. Specific information includes: book ISBN, book name, author, publishing house, publication date, printing times, unit price, book category and so on. (the relevant stored data can be stored in the file directly through the Istroke O stream, but can also be read directly in the file)
(3) Book lending management: including the functions of book lending and book return. The book lending function, first enter the reader's number, and then enter the information of the book to be borrowed, and record the current time of the system, that is, the borrowing time; the book return function, enter the reader's number and select the borrowed book under its name. judge whether the difference between the current date, that is, the return date and the borrowing date exceeds the prescribed time limit, calculate the fine, so as to carry out the return operation of the book. Specific information includes: borrowing date, return date, fine. In order to calculate the fine, it is necessary to know the reader type of the reader, and judge the number of days and the number of books available according to the type. (the relevant stored data can be stored in the file directly through the Istroke O stream, but can also be read directly in the file)
(4) basic information maintenance: including book category setting, reader category setting and fine setting. Book category settings, you can add, delete, modify and query the categories of books; reader category settings can add, delete, modify and query the categories of readers; fine settings, you can specify the penalty standard of one day overdue. (the relevant stored data can be stored in the file directly through the Istroke O stream, but can also be read directly in the file)
(5) user management: including password modification, user addition and deletion. Changing the password means that the current user modifies his own password; the addition and deletion of users is the maintenance of user information when adding and removing system users. (the relevant stored data can be stored in the file directly through the Istroke O stream, but can also be read directly in the file)
Project Analysis:
Let's take a look at the analysis of the project, which is also based on adding, deleting, changing and checking. I believe we are not unfamiliar with it.
What distinguishes team scheduling from the previous project 1 is that the data for this project is saved through IO streams, which has the following advantages:
The data we save will not be erased when the project is restarted, but will always be in the file. From the point of view of data preservation, it is a better choice.
Through demand:
We can divide the implementation of these modules into three class packages and one packet: (as the blogger wrote):
The three packages are: interface display package (full of display classes) and function implementation package (implementation class of each function)
Entity class package (put each entity class that needs to be used); data package (store all kinds of data used)
(-) user management module
First of all, we enter the book management system, the way to enter is through the user's account and password input matching.
User login:
When designing this feature, we chose to save the data in a file, that is, to do it with an IO stream.
When the IO flow is determined, we can choose the corresponding implementation method. (1) Properties is combined with the IO stream, and the setting value is to get the value according to the key. (2) write with serialization and deserialization.
Here, the blogger chose to write in Properties. By setting a key-value pair, the key represents the account and the value represents the password. And the data can be read directly and intuitively in the file.
The second is the addition, deletion, modification and search of user data.
Because IO streams will be used, an exception needs to be thrown to implement file data read and write operations. You can use the keyboard shortcuts:
Alt+Enter to quickly implement.
Note:
When storing and modifying data, we need to read the previous data into the Properties collection before writing the new data.
In the file. This prevents you from accidentally overwriting the data you wanted to keep every time you write the data.
Another point is that when the user logs in successfully and performs the function of deleting user data, we cannot delete the current user data. You only need to add a judgment statement here.
At this point, the user management module is basically completed.
(2) basic information maintenance module
Under this module, there are settings for reader categories, book categories, and fines.
Reader category, that is, when we add readers, we can add the reader category as an attribute of the reader class.
For example, if the type of reader we currently add is students, then we can set the number of days and the number of books that students can borrow separately.
By the same token, books can be classified by setting the category of books.
Fine setting: different types of fines can be set according to different types of readers.
Partial code display (setting of reader type):
Public class ReaderTypeServe {static String typeid,typename,limit,maxborrownum; / / add reader types public static void addReaderType () throws IOException, ClassNotFoundException {boolean flog=true; System.out.println ("Welcome to the reader category add interface"); / / read the data in the file and save it to the collection. TSUtility.readReaderType (); ArrayList array=TSUtility.readerTypesArray; System.out.println (); / * if (array.size () = = 0) {System.out.println ("Reader type information not detected.") } * / while (true) {try {System.out.println ("Please add the reader's unique class model: (positive)"); typeid=TSUtility.readKeyBoard (3) false; if (Integer.parseInt (typeid) > = 0) {break } else {System.out.println ("incorrect format, please check and enter:");}} catch (NumberFormatException e) {System.out.println ("Please enter the corresponding integer.") }} for (ReaderType reader: array) {if (typeid.equals (reader.getTypeid () {System.out.println ("this id has been used, automatically return to the previous interface!") ; flog=false; break;}} if (flog) {System.out.println ("Please enter reader type name:"); typename = TSUtility.readKeyBoard (4) For (ReaderType reader: array) {if (typename.equals (reader.getTypename () {System.out.println ("this type has been used, automatically return to the previous interface!") ; flog=false; break;} if (flog) {while (true) {try {System.out.println ("Please set the number of days that can be borrowed: (positive number, and cannot exceed 100days)") Limit = TSUtility.readKeyBoard (2) false; if (Integer.parseInt (limit) > = 0&&Integer.parseInt (typeid) = 0&&Integer.parseInt (typeid))
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.