break;
case 3:
booknames[i]="七界仙尊 ";
authors[i]="无良书生";
pubdates[i]="2017-04-04";
sumpaginations[i]="1310";
break;
case 4:
booknames[i]="恋上调皮公主";
authors[i]="残落筱筱";
pubdates[i]="2012-08-20";
sumpaginations[i]="954";
break;
}
}
}
}
public String[] booknames = new String[10];// 书名
public String[] authors = new String[10];// 作者
public String[] pubdates = new String[10];// 出版日期
public String[] sumpaginations = new String[10];// 总页数
public String[] borrowreaders = new String[10];// 借阅人
}
//在Bo.java中输入以下代码
package com.jiaxun.library.bo;
import java.util.Scanner;
import com.jiaxun.library.data.BookData;
import com.jiaxun.library.data.UserData;
public class Bo {
public static BookData book = new BookData();
UserData user = new UserData();
// 管理员登录验证
public int login(String username, String password) {
if (username.equals(user.getUser())) {
if (password.equals(user.getPassword())) {
return 1;// 账号和密码验证通过
} else {
return 0;// 密码错误
}
} else {
return -1;// 账号不存在
}
}
/*
* 菜单功能展示列表
*
* 图书信息展示功能
*/
public void showBook() {
System.out.println("本图书馆共有" + (book.booknames.length - remainSpace()) + "本书");
int a = bookinfo();
if (a == 0) {
// 展示所有图书信息
showAll();
} else if (a > 0 && a <= book.booknames.length) {
// 展示相关图书信息
showPart(a);
} else {
System.out.println("输入的编号不合法!");
showBook();
}
}
// 展示所有图书信息
public void showAll() {
for (int i = 0; i < book.booknames.length; i++) {
if (book.booknames[i] != null) {
System.out.println("---------------------------------------编号" + (i + 1)
+ "--------------------------------------------------------------");
System.out.println("书籍编号为" + (i + 1) + "的详细信息为:");
System.out.print("书名:" + book.booknames[i] + " ");
System.out.print("作者:" + book.authors[i] + " ");
System.out.print("出版日期:" + book.pubdates[i] + " ");
System.out.print("总页数:" + book.sumpaginations[i] + " ");
System.out.println("借阅者:" + book.borrowreaders[i]);
}
}
System.out.println(
"---------------------------------------------------------------------------------------------------------");
}
// 展示相关图书信息
public void showPart(int a) {
int i = a;
System.out.println(
"---------------分界线---------------------------------------------------------------------------------------------------");
System.out.println("书籍编号" + (i) + "的详细信息为:");
System.out.print("书名:" + book.booknames[i - 1] + " ");
System.out.println("作者:" + book.authors[i - 1] + " ");
System.out.print("出版日期:" + book.pubdates[i - 1] + " ");
System.out.print("总页数:" + book.sumpaginations[i - 1] + " ");
System.out.println("借阅者:" + book.borrowreaders[i - 1]);
System.out.println(
"---------------------------------------------------------------分界线---------------------------------------------------");
}
//根据编号判断要全局展示还是部分展示
public int bookinfo() {
for (int i = 0; i < book.booknames.length; i++) {
评论0