package cn.vscoder.experiment_3.test;

import cn.vscoder.experiment_3.book.RentBook;
import cn.vscoder.experiment_3.common.PayException;
import cn.vscoder.experiment_3.reader.VIPReader;
import cn.vscoder.experiment_3.rent.RentBookManage;

public class TestRentBookManage {
    public static void main(String[] args) throws PayException {
        System.out.println("欢迎进入图书租阅管理系统！");
        RentBookManage bm = new RentBookManage();
        bm.addBook(new RentBook("0001", "java", "王三", "南京大学出版社", 23.5, "in001"));
        bm.addBook(new RentBook("0002", "eclipse", "王婆", "北京大学出版社", 53.5, "in002"));
        bm.addBook(new RentBook("0003", "数据结构", "张斯", "清华大学出版社", 45.5, "in003"));
        bm.addBook(1, new RentBook("0004", "数据分析", "鱼鱼", "忧伤出版社", 45.3, "in005"));
        bm.displayAllBooks();
        RentBook rentBook = bm.searchBook("java");
        bm.editBook("java", 100);
        bm.deleteBook("数据分析");
        bm.displayAllBooks();

        bm.addReader(new VIPReader("张三", "普通会员"));
        bm.addReader("李四", "VIP");
        bm.addReader("王二", "非会员");
        bm.displayAllReaders();

        if (bm.rentBook(bm.readerlist.get(0), bm.searchBook("eclipse"), 10)) {
            bm.printRentlist();
        } else {
            bm.readerlist.get(0).setBalance(100);

        }
        bm.rentBook(bm.readerlist.get(0), bm.searchBook("eclipse"), 10);
        bm.printRentlist();


    }
}
