DVDMgr类
建德网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联2013年至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。
package adminDVD;
import java.util.Scanner;
public class DVDMgr {
DVDSet dvd = new DVDSet();
public void setData() {
//初始化数据
//int[] state = dvd.state;
dvd.initial();
}
public void startMenu() {
System.out.println("欢迎使用 MiniDVD Mgr 1.0");
System.out.println("----------------------------------------------");
System.out.println("1.查看DVD");
System.out.println("2.借出DVD");
System.out.println("3.退出 MiniDVD Mgr");
System.out.println("请选择:");
Scanner input = new Scanner(System.in);
int choice = input.nextInt();
switch (choice) {
case 1:
search();
//执行查询
break;
case 2:
lend();
//标记借出
break;
case 3:
System.out.println("\n欢迎使用!");
break;
}
}
public void search() {
System.out.println("MyDVd Mgr 1.0 --- 查询DVD \n");
String[] A = dvd.name;
int[] B = dvd.state;
String C;
for (int i = 0; i A.length; i++) {
if (A[i] == null) {
break;
}
if (B[i] == 0) {
C = "已借出";
System.out.println(A[i] + "\t\t" + C);
} else {
System.out.println(A[i]);
}
}
System.out.println("------------------------------");
System.out.println("输入0返回");
returnMain(); //调用返回块
}
public void returnMain()
{
//System.out.println("输入0 返回");
Scanner input = new Scanner(System.in);
int num = input.nextInt();
if (num == 0) {
startMenu();
}
}
public void lend() {
System.out.println("MyDVD Mgr 1.0 --- 借出DVD \n");
System.out.println("请输入要借的DVD名称");
Scanner input = new Scanner(System.in);
String name = input.next();
for (int i = 0; i dvd.name.length; i++) {
if(dvd.name[i]==null){
System.out.println("操作不成功!");
break;
}else if(name.equals(dvd.name[i]) dvd.state[i] == 1){
dvd.state[i] = 0;
System.out.println("操作成功!");
break;
}else if(name.equals(dvd.name[i]) dvd.state[i] == 0){
System.out.println("《"+dvd.name[i]+"》"+"\t\t已借出!");
break;
}
/*if (dvd.name[i].equals(name[i]) dvd.state[i] == 1) {
dvd.state[i] = 0;
System.out.println("操作成功!");
break;
} else {
System.out.println("操作不成功!");
break;
}*/
}
System.out.println("输入0返回");
returnMain();
}
public static void main(String[] args) {
DVDMgr mgr = new DVDMgr();
mgr.setData();
mgr.startMenu();
}
}
DVDSet类
package adminDVD;
import java.util.Scanner;
public class DVDSet {
String[] name = new String[50];
// 数组1存储DVD名称数组
int[] state = new int[50];
// 数组2存储DVD状态
public void initial() {
/*name[0]="风云II";
state[0]=1;
name[1]="英雄";
state[1]=1;
name[2]="罗马假日";
state[2]=1;
name[3]="无极";
state[3]=0;*/
Scanner input = new Scanner(System.in);
String answer = "y";
for (int i = 0; i name.length; i++) {
System.out.print("第" + (i + 1) + "的DVD名称:");
name[i] = input.next();
System.out.println("是否借出?(0:借出 1:可借)");
state[i] = input.nextInt();
System.out.print("是否继续(y/n)");
answer = input.next();
if (answer.equals("n"))
{
break;
}
}
}
}
一个项目的问题没人会解答的,要么你就开始做问点具体的问题,要么给钱帮你做完
应该是把DVD编辑器这个插件下载下来,在你写java的软件里,然后你在调用