Java 图书管理系统设计与实现
本教程将使用 Java 面向对象编程思想,基于类、对象、继承、多态及接口实现一个控制台图书管理系统。系统包含 Book、BooList、User、NormalUser、AdminiUser 等核心类,通过接口 IOperation 统一管理业务操作。
一、package book
1.1. Book
定义书籍实体类,包含书名、作者、价格、类型及借阅状态。
package book;
public class Book {
private String title; // 书籍名称
private String author; // 作者
private int price; // 价格
private String type; // 类型
private boolean BeBorrowed; // 是否被借出
public Book(String title, String author, int price, String type, boolean beBorrowed) {
this.title = title;
this.author = author;
this.price = price;
this.type = type;
this.BeBorrowed = beBorrowed;
}
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public String getAuthor() { return author; }
public void setAuthor { .author = author; }
{ price; }
{ .price = price; }
String { type; }
{ .type = type; }
{ BeBorrowed; }
{ BeBorrowed = beBorrowed; }
String {
+
+ title + +
+ author + +
+ price +
+ type + +
+ BeBorrowed +
;
}
}


