
一、知识内容付费阅读网站源码开发流程,如下:
●数组的增删
●抽象类
●界面
完整源码:zs.xcxyms.top
面向对象的封装、继承和多态
二、系统功能如下:
●系统的用户有两种:①管理者和②普通用户
●具体实现:抽象类的继承
用户类:
public abstract class User {
protected String name;
protected IOperation[] iOperations;
public User(String name){
this.name=name;
}
public abstract int menu();
public void doWork(int choice, BooklList booklList){
iOperations[choice].work(booklList);
}
}
Adminuser 类(管理员):
public class AdminUser extends User {
public AdminUser(String name){
super(name);
this.iOperations=new IOperation[] {
new ExitOperation(),
new FindOperation(),
new AddOperation(),
new DelOperation(),
new DisplayOperation()
};
}
public int menu()
}
Normaluser 类(普通用户类):
public class NormalUser extends User {
public NormalUser(String name){
super(name);
this.iOperations=new IOperation[]{
new ExitOperation(),
new FindOperation(),
new BorrowOperation(),
new ReturnOperation()
};
}
public int menu()
}
具体实现:知识库类中的所有私有属性都提供了公共接口。在 booklist 类中创建了一个名为 books 的数组,并存储了知识库。此外,还设计了一个名为 usedsize of booklist 的成员来表示书知识库数组中存储的知识库数量。
知识库类:
public class Book {
private String name;// title费城76人比赛前瞻
private String author;// Author of the book
private int price;// Book price
private String type;// Types of books
private boolean isBorrowed;// Lend
public Book(String name, String author, int price, String type) {
this.name = name;
this.author = author;
this.price = price;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isBorrowed() {
return isBorrowed;
}
public void setBorrowed(boolean borrowed) {
isBorrowed = borrowed;
}
@Override
public String toString() 39;;
}
}
分别设计了七个类,每个类实现一个功能;一个接口被设计成串联七个类。
具体实现:addoperation、borrowoperation、deloperation、displayoperation、exitoperation、findoperation、returnoperation、接口ioperation
添加操作
public class AddOperation implements IOperation
}

