DVDMgr類
建德網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項目制作,到程序開發(fā),運營維護(hù)。創(chuàng)新互聯(lián)2013年至今到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)。
package adminDVD;
import java.util.Scanner;
public class DVDMgr {
DVDSet dvd = new DVDSet();
public void setData() {
//初始化數(shù)據(jù)
//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();
//執(zhí)行查詢
break;
case 2:
lend();
//標(biāo)記借出
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(); //調(diào)用返回塊
}
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];
// 數(shù)組1存儲DVD名稱數(shù)組
int[] state = new int[50];
// 數(shù)組2存儲DVD狀態(tài)
public void initial() {
/*name[0]="風(fēng)云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("是否繼續(xù)(y/n)");
answer = input.next();
if (answer.equals("n"))
{
break;
}
}
}
}
一個項目的問題沒人會解答的,要么你就開始做問點具體的問題,要么給錢幫你做完
應(yīng)該是把DVD編輯器這個插件下載下來,在你寫java的軟件里,然后你在調(diào)用