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

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

交作業(yè)了,萌新求指教。

package mytest;


import java.util.Scanner;


public class Hdl {

static String s[]=new String[]{"高數(shù)","大學英語","政治","java"};

public static void main(String[] args) {

// TODO 自動生成的方法存根

Choose();

}

public static void Choose(){

System.out.println("輸入命令:1—按照名稱查找圖書;2-按照序號查找圖書");

try{

Scanner sc=new Scanner(System.in);

? ? int i=sc.nextInt();

? ? if(i==1){

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

tushu();

}else if(i==2){

System.out.println("請輸入序號:");

xuhao();

}else {

System.out.println("輸入的命令有誤,請根據(jù)提示輸入數(shù)字!");

Choose();

}

? ? }catch(Exception e){

? ? ?

? ? }

}

public static void tushu(){

try{

Scanner a=new Scanner(System.in);

? ? String x=a.nextLine();

? ? Name(x);

? ? ? ? if(x.equals(s[0])){

System.out.println("book:"+s[0]);}

else if(x.equals(s[1])){

System.out.println("book:"+s[1]);}

else if(x.equals(s[2])){

? ? ? ? ? ? System.out.println("book:"+s[2]);}

else if(x.equals(s[3])){

? ? ? ? ? ? ? ? ? ? ?System.out.println("book:"+s[3]);

}

}catch(Exception e){

System.out.println(e.getMessage());

Choose();

}

}

public static void xuhao(){

try{

Scanner b=new Scanner(System.in);

? ? int y=b.nextInt();

? ? Number(y);

if(y==1){

System.out.println("book:"+s[0]);}

else if(y==2){

System.out.println("book:"+s[1]);}

else if(y==3){

? ? ? ? ? ? System.out.println("book:"+s[2]);}

else if(y==4){

? ? ? ? ? ? ? ? ? ? ?System.out.println("book:"+s[3]);

? ? }


}catch(Exception e){

System.out.println(e.getMessage());

Choose();

}

}

public static String Name(String x)throws Exception{

if(!(x.equals(s[0]))&&!(x.equals(s[1]))&&!(x.equals(s[2]))&&!(x.equals(s[3]))){

throw new Exception("圖書不存在");

}

return x;

}

public static int Number(int y)throws Exception{

if(y<1^y>4){

throw new Exception("圖書不存在");

}

return y;

}

}


正在回答

1 回答

牛掰啊

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

交作業(yè)了,萌新求指教。

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號