package cn.lxw;
import java.util.Scanner;
//public class test {
//
// public static void main(String[] args) {
// test test=new test();
// test.begin();
// }
//
// private Scanner in = new Scanner(System.in);
//
// private void begin() {
// while (true) {
// printMainMenu();
// int choice = in.nextInt();
// switch (choice) {
// case 1:
// userManage();
// break;
// case 2:
// diskManage();
// break;
// case 3:
// borrowDisk();
// break;
// case 4:
// returnDisk();
// break;
// case 5:
// return;
// }
// }
//
// }
//
// private void returnDisk() {
// // TODO 自动生成方法存根
//
// }
//
// private void borrowDisk() {
// // TODO 自动生成方法存根
//
// }
//
// private void diskManage() {
// // TODO 自动生成方法存根
//
// }
//
// private void userManage() {
// while (true) {
// printUserManageMenu();
// int choice = in.nextInt();
// switch (choice) {
// case 1:
// addUser();
// break;
// case 2:
// removeUser();
// break;
// case 3:
// findUser();
// break;
// case 4:
// listUser();
// break;
// case 5:
// return;
// }
// }
// }
//
// private void listUser() {
// // TODO 自动生成方法存根
// //userBook.listUser();
// }
//
// private void findUser() {
// // TODO 自动生成方法存根
//
// }
//
// private void removeUser() {
// // TODO 自动生成方法存根
//
// }
//
// private void addUser() {
// // TODO 自动生成方法存根
// //String name = in.next();
// //int id = in.nextInt();
// //.....
// // User user = new User(id,name,money);
// //userBook.addUser(user);
// }
//
// private void printUserManageMenu() {
// System.out.println("1:add user");
// System.out.println("2:remove user");
// System.out.println("3:find user");
// System.out.println("4:list user");
// System.out.println("5:return");
// }
//
// private void printMainMenu() {
// System.out.println("1:会员管理");
// System.out.println("2:disk manage");
// System.out.println("3:borrow");
// System.out.println("4:return");
// System.out.println("5:exit");
// System.out.println("please choice:");
// }
// }
//
//
public class test {
UserBook book = new UserBook();
DiskStore CK = new DiskStore();
// Disk disk = new Disk();
public static void main(String[] args) {
test test=new test();
test.begin();
}
private Scanner in = new Scanner(System.in);
private void begin() {
CK.cdChushihua();
book.userChushihua();
book.addUser("王梅");
book.addUser("李雷");
while(true){
printMainMenu();
int choice = in.nextInt();
switch(choice){
case 1 :
UserManager();break;
case 2:
DiskManager();break;
case 3:
borrow();break;
case 4:
returnCD();break;
case 5:
return;
}
}
}
private void returnCD() {
int x,y;
System.out.println("请输入会员编号:");
x=in.nextInt();
System.out.println("请输入CD编号:");
y=in.nextInt();
CK.repay(y);
book.returnDisk(x, y);
}
private void borrow() {
int x,y;
System.out.println("输入会员编号:");
x=in.nextInt();
System.out.println("输入CD编号:");
y=in.nextInt();
CK.borrowDisk(y);
book.lendDisk(x, y);
}
private void DiskManager() {
while(true){
printDiskManager();
String x;
int y;
int choice=in.nextInt();
switch(choice){
case 1:
System.out.println("输入CD名:");
x=in.next();
System.out.println("输入CD数目:");
y=in.nextInt();
CK.addDisk(x, y);
break;
case 2:
System.out.println("输入CD名:");
x=in.next();
System.out.println(x);
CK.foundDisk(x);
break;
case 3:
CK.cdList();
break;
case 4:
return;
}
}
}
private void UserManager() {
while(true){
printUserManager();
String x;
int y;
int choice=in.nextInt();
switch(choice){
case 1:
System.out.println("输入会员姓名:");
x=in.next();
book.addUser(x);
break;
case 2:
System.out.println("输入会员编号:");
y=in.nextInt();
book.removeUser(y);
break;
case 3:
System.out.println("输入会员编号:");
y=in.nextInt();
book.foundUser(y);
break;
case 4:
book.UserList();
break;
case 5:
return;
}
}
}
private void printMainMenu() {
System.out.println("1:会员管理");
System.out.println("2:CD管理");
System.out.println("3:租借CD");
System.out.println("4:归还CD");
System.out.println("5:退出");
System.out.println("please choice:");
}
private void printDiskManager() {
System.out.println("1:添加CD");
System.out.println("2:查找CD");
System.out.println("3:CD列表");
System.out.println("4:返回");
System.out.println("please choice:");
}
private void printUserManager() {
System.out.println("1:添加会员");
System.out.println("2:移出会员");
System.out.println("3:查找会员");
System.out.println("4:会员列表");
System.out.println("5:返回");
System.out.println("please choice:");
}
}