JAVA图书管理系统不⽤数据库_java简单的图书管理系统(只⽤java代码不⽤数据库和可。。。
java控制台输⼊图书管理系统信息,(不⽤数据库和可视化界⾯,java学习新⼿秒懂)使⽤多层框架实现功能
图书管理系统需求:
⼀. 登录页⾯
1.管理员通过输⼊⽤户名和密码能够进⼊后台进⾏操作
2.可以进⾏注册
3.可以退出
⼆.后台操作有:
1.查询所有图书
2.根据作者查询
3.根据出版社查询图书
java开发可视化界面4.根据图书名称进⾏查询
5.增加图书
6.修改图书数量
7.根据图书编号删除图书
8.返回上⼀菜单
三.类的属性
管理员类 (Admin)
- 序号
- ⽤户名
- 密码
书库类(Book)
-
图书编号
- 图书名称
- 作者
- 总页数
- 出版社
- 图书数量
案列的项⽬布局如下图所⽰:
实体 Admin类的代码
ity;
public class Admin {
private int no; //序号
private String adid; //⽤户名
private String adpwd;//⽤户密码public int getNo() {
return no;
}
public void setNo(int no) {
< = no;
}
public String getAdid() {
return adid;
}
public void setAdid(String adid) { this.adid = adid;
}
public String getAdpwd() {
return adpwd;
}
public void setAdpwd(String adpwd) { this.adpwd = adpwd;
}
public Admin(int no, String adid, String adpwd) {
super();
< = no;
this.adid = adid;
this.adpwd = adpwd;
}
@Override
public String toString() {
return "Admin [no=" + no + ", adid=" + adid + ", adpwd=" + adpwd + "]"; }
public Admin() {
super();
}
}
entity 包下Book类的代码
ity;
public class Book {
private String ISBN; //图书编号
private String bookName; //书名
private String author; //作者
private int pagenum; //总页数
private String publisher; //出版社
private int bookcount; //图书数量
public String getISBN() {
return ISBN;
}
public void setISBN(String iSBN) {
ISBN = iSBN;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPagenum() {
return pagenum;
}
public void setPagenum(int pagenum) {
this.pagenum = pagenum;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public int getBookcount() {
return bookcount;
}
public void setBookcount(int bookcount) {
this.bookcount = bookcount;
}
@Override
public String toString() {
return "Book [图书编号=" + ISBN + ", 图书名称=" + bookName + ", 作者=" + author + ", 总页数=" + pagenum + ", 出版社=" + publisher
+ ", 图书数量=" + bookcount + "本]";
}
public Book(String iSBN, String bookName, String author, int pagenum, String publisher, int bookcount) {
super();
ISBN = iSBN;
this.bookName = bookName;
this.author = author;
this.pagenum = pagenum;
this.publisher = publisher;
this.bookcount = bookcount;
}
public Book() {
super();
}
}
BookDao类
package com.Dao;
import java.util.List;
ity.Book;
public interface BookDao {
public List getAllList();//获取所有图书
public boolean addbook(Book book);//新增图书
public boolean deletebook(Book book);//删除图书
public boolean updatebook(Book book); //修改图书数量
}
BookDaoImpl类继承BookDao接⼝类的代码
package com.Dao.Impl;
import java.util.ArrayList;
import java.util.List;
import com.Dao.BookDao;
ity.Book;
public class BookDaoImpl implements BookDao {
List booklist=new ArrayList();
public void init(){
Book book1=new Book("ISBN1001","西游记","吴承恩",100,"⼈民出版社",20);
Book book2=new Book("ISBN1002","假如给我三天光明","张三",100,"合肥出版社",15); Book book3=new Book("ISBN1003","红楼梦","李四",100,"⼈民出版社",25);
Book book4=new Book("ISBN1004","钢铁是怎样炼成的","翠花",100,"北京出版社",10);
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论