Java____西财大图书管理系统论文

Book Management Project of Xi’an University of Finance and Economics Abstract

There plays an extremely important role in the library in each of our college life.Affected by the epidemic, I decided to design and develop a simple book management system based on the library of Xi’an University of Finance and Economics to realize the function that we can borrow books without going to the library.The book management system includes the user borrowing information and all the book information, this system, I designed two types of users: one is ordinary users, they can display books, borrow books, return books; the other is the administrator, they can display books, increase books, remove books and other functions.

Introduction

Many colleges and universities have libraries, which can provide a space for all teachers and students to read and learn.In the face of the current huge amount of information, we have designed a reasonable, effective, standardized, practical library management system, and innovated in this system, in order to facilitate the use of users and administrators, so we create a unified and centralized management of school books and materials.
The book management system of Western University of Finance and Economics is generally divided into three entities (categories): users, books and bookshelves, there are additional books, query books, delete books and other operating behaviors (Operation).
User class
User class (abstract classes) include administrators and normal users.
Methods included by administrator users: (1) Show the list of books (2) Add books (3) Remove books (4) Update the price of books —— update books, update the type of books.The method included by the ordinary user: (1) Show the current list of all existing books (2) query books (3) borrow books (4) return books (5) exit.Property of the user class (abstract class): username, IOperation (user permission).Methods: (1) —— an abstract method in the user menu, specific menu for subclass implementation (2) doOperation (int choice—— user selection, BookList booklist—— operation on the shelf.
Book class
The attributes of books include: book name, book author, book price, secretary type, and borrowing status of books.
Operating behavior-Interface IOperation
Operating behaviors include: AddOperation, UpdateOperation, RemoveOperaton, FindOpreation, DisplayOperation, BorrowOperation, and ReturnOperation
Method: operate (BookList booklist)
BookList class
Properties of the shelf class: All books are stored in the shelf category (dynamic array) Book [], list of all book names String [] -Book name for each book.

Realize

Figure 1.We started writing the Operation class and the first thing we should do is define an interface IOperation which need to explain that IOperation is the behavior of operating the book list.There is a working method in this interface, here we want to pass a BookList class, is a subclass common method, according to the incoming BookList checking and borrowing operations, note that these operations need user input we use scanner class, the specific operation is implemented by the subclass.There are global constants and abstract methods in the interface to obtain user input.
The IOperation is an interface, Next I i will start to write the implementation, Add-delete and change-check are its subclass implementation, We all put it in a subpackage called impl, AddOperation is to add book operations, RemoveOperation is the delete book action, UpdateOpreation is updated book operations, FindOperation is the Find book operation, DisplayOperation is all the books showing the current bookshelf, The BorrowOperation is a book-borrowing operation, ReturnOperation is a book return operation, Here we have done all the code part of the regular operation, All the things put in the impl are the implementation.Note that the user exit is not operating on the BookList, so temporarily do not write the exit section.
Figure 2.Second we start by creating the simplest Book-class, which has only some of the simplest properties and methods.This class is the entity class corresponding to each book, each book is an entity class in our real life, abstracted into JAVA code is a class, which should contain BookName, BookAuthor, BookPrice, BookType, as well as the borrowing state of the book.This part of the difficulty lies in the class design.nameString, authorString, priceString, priceString, typeString provides construction methods, external transfer.We need to note that the default value for the boolean type is False, just enough for this design.After there is a construction method, at this time to create a book title, author, price, book type all exist, to obtain a title getName, the same author is also getAuthor.Price getprice / setprice, Type gettype / settype, Lending status isBorrowed.
Figure 3.Attribute of the user class (abstract class): user name, menu method —— specific implementation is currently uncertain specific implementation to the subclass (the return value is the user input number, according to the number), user rights, when this array cannot be initialized, different user rights are different.NormalUser Common User class
Ordinary user class is needed external to call, its permission is public, according to the Operation array of the subclass has new DisplayOperation, new FindOperation, new BorrowOperation, new ReturnOperation.Manu directly output: " 1. Show the current book list 2. Check up the books 3. Borrowing the books 4. Return the books.-1. Exit, please enter your choice:"
The permission of the administrator class is also public, the construction method is new AddOperation, new RemoveOperation, new UpdateOperation, new FindOperation, new DisplayOperation.Manu direct output: “1. Add Book List 2. Remove Books 3. Update books 4. Find books 5. Show the current book list-1. Exit, please enter your choice:”
The user logs in, the first inputs the user name, and the second determines the user identity according to the user selection.Next we write a landing method, the menu directly output: " Please enter the user name!"" Please enter your identity, 1 for the average user and 0 the administrator."Create objects based on the user, as implemented in the code.
Figure 4.The BookList class uses a dynamic array built into the JDK, holds specific to each book object, holds all book names as an index to both the operating books and initialize.About the book shelves, off the shelves, inquiries are operated under BookList.

Result

There are three packages: Book, Operation, and User
The Book class stores two subclasses: Book, BookList
The Operation storage interface is IOperation and a specific subclass implementation
User Storage: abstractUser, NormalUser, and AdminUser

This is the interface when we log in as an ordinary user, we can see the menu shown in the figure below, you can choose different numbers according to what you want to do, you can input 1~5, to do different operations.

This is how we enter the library with the role of administrator, and after entering the interface, we will see the options shown in the figure, and we will enter the corresponding number according to the operation needed.

Reference

1.《Effective Java》作者:(美)Joshua Bloch 译者:潘爱民
2.《Spring揭秘》作者:王福强
3.《Java多线程编程核心技术》《JAVA并发编程 核心方法与框架》作者: 高洪岩

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值