第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

新手寫代碼,可能比較繁復(fù)

public class book {


public static void main(String[] args) throws book_dontexist, error_command

{

book book1=new book();

book1.borrow_book1();

}

public? void borrow_book1() throws book_dontexist, error_command

{

//book book1 = new book();

System.out.println("1-按照名稱查找圖書;2-按照序號查找圖書");

Scanner input=new Scanner(System.in);

int? command=input.nextInt();

if(command!=1&&command!=2)

{

try {

? ? ? ? throw new error_command("命令輸入錯誤!請根據(jù)提示輸入命令");

? ? ? ? ?}

? ? catch(error_command m) {

? ? ?

? ? }

? ? finally {

? ? borrow_book1();

? ? }

}

String[] library ={"小王子","玻璃城堡","悲慘世界","心理罪","殺死一只知更鳥"};

if(command==1)

{

? ?System.out.println("輸入圖書名稱");

? ?int m=0;

? ?Scanner input1=new Scanner(System.in);

? ?String bookname=input1.next();

? ? ? ?for(int i=0;i<library.length;i++)

? ? ? ?{

? ? ? ?

? ? ? ?if(bookname.contentEquals(library[i]))

? ? {

? ?m++;

? ?System.out.println("book:"+bookname);// System.out.println(library[i]);

? ? }?

? ? ? ? ?if((i==library.length-1)&&(m==0))

? ? ? ? ?{

? ? ? ? try {

? ? ? ? throw new book_dontexist("圖書不存在");

? ? ? ? ?}

? ? catch(book_dontexist e) {

? ? ?

? ? }

? ? finally {

? ? borrow_book1();

? ? }

? ? ? ? ?}

? ? ? ? ?

? ? ? ?}

}

if(command==2)

{

? ?System.out.println("輸入圖書序號");

? ?int m=0;

? ?Scanner input2=new Scanner(System.in);

? ?int? num=input2.nextInt();

? ? ? ?

? ? ? ?

? ? ? ?if(num<library.length)

? ? {

? ?System.out.println("book:"+library[num]);// System.out.println(library[i]);

? ? }?

? ? ? ?else?

? ? ? ? ?{

? ? try {

? ? ? ? throw new book_dontexist("圖書不存在");

? ? ? ? ?}

? ? catch(book_dontexist e) {

? ?

? ? }

? ? finally {

? ? borrow_book1();

? ? }

? ? ? ? ?}


}

? }


}


正在回答

1 回答

類最好是首字母大寫

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

新手寫代碼,可能比較繁復(fù)

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號