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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

圖書(shū)管理系統(tǒng),有沒(méi)有寫(xiě)的好的答案?

圖書(shū)管理系統(tǒng),有沒(méi)有寫(xiě)的好的答案?

正在回答

1 回答

寫(xiě)這段代碼的時(shí)候,只有上帝和我知道什么意思。???現(xiàn)在,只有上帝知道。

package?com.imooc;

import?java.util.Scanner;

public?class?Test?{
	public?static?void?main(String[]?args)?{
		
		String[]?s?=?{"唐詩(shī)300首","格林童話(huà)","java編程思想","計(jì)算機(jī)操作系統(tǒng)"};
		
		System.out.println("歡迎來(lái)到圖書(shū)管理系統(tǒng)");
		
		while(true)?{
			int?number?=?0;
			while(true)	{
				System.out.println("選擇菜單?:輸入1:進(jìn)入書(shū)名查找模式???輸入2:進(jìn)入圖書(shū)序列號(hào)查找模式");
				Scanner?sc?=?new?Scanner(System.in);
				try{
					?number?=?sc.nextInt();
				}catch(Exception?a)?{
					System.out.println("錯(cuò)誤命令異常,請(qǐng)重新輸入");
					sc?=?null;
					continue;
				}
				
				if(number?>=1?&&?number?<=2)?{
					break;
				}else?{
					System.out.println("沒(méi)有該選項(xiàng)!請(qǐng)重新輸入");
				}
			}
			
			
			
			if(number?==?1)?{
				while(true){	
					System.out.print("請(qǐng)輸入要查找的書(shū)名:");
					Scanner?sc2?=?new?Scanner(System.in);
					String?book?=?null;
					try{
						?book?=?sc2.nextLine();
					}catch(Exception?b)?{
						System.out.println("錯(cuò)誤命令異常,請(qǐng)重新輸入!");
						sc2?=?null;
						continue;
					}
					
					boolean?b?=?true;
					for(int?x=0;x<s.length;x++)?{
							if(s[x].equals(book))?{
								System.out.println(s[x]+"這本書(shū)存在!");
								b?=?false;
								break;
							}
					}
					if(b)?{
						System.out.println(book+"這本書(shū)不存在");
						System.out.println("是否重新輸入:是/否");
						Scanner?sc5?=?new??Scanner(System.in);
						if(sc5.nextLine().equals("是"))?{
							continue;
							
						}
					}
					break;
				}
			}else?if(number?==?2)?{
				while(true)?{
					System.out.print("請(qǐng)輸入要查找的序列號(hào):");
					int?y;
					Scanner?sc4?=?new?Scanner(System.in);
					try{
						?y?=?sc4.nextInt();
					}catch(Exception?c)?{
						System.out.println("錯(cuò)誤命令異常,請(qǐng)重新輸入");
						continue;
					}
						
					boolean?flag?=?false;
					for(int?x=0;x<s.length;x++)?{
						
						try{
							if(s[x].equals(s[y]))?{
								System.out.println("序列號(hào)"+y+"為"+s[x]+"這本書(shū)存在!");
								System.out.println("是否繼續(xù)查詢(xún):是/否");
								Scanner?sc6?=?new??Scanner(System.in);
								String?choose3?=?sc6.nextLine();
								if(choose3.equals("是"))?{
									break;
								}else?if(choose3.equals("否")){
									flag?=?true;
								}
								break;
							}
						}catch(Exception?e)?{
							System.out.println("圖書(shū)不存在異常!");
							System.out.println("是否重新輸入:是/否");
							Scanner?sc5?=?new??Scanner(System.in);
							String?choose2?=?sc5.nextLine();
							if(choose2.equals("是"))?{
								break;
							}else?if(choose2.equals("否")){
								flag?=?true;
								break;
							}
						}
					}
				if(flag)?{
					break;
				}
				
				}
		
		
			}
			
			Scanner?i?=?new?Scanner(System.in);
			String?choose?=?null;
			while(true)?{
				System.out.println("是否返回選擇菜單??是/否");
				
				try{
					choose?=?i.nextLine();
					break;
				}catch(Exception?e)?{
					System.out.println("輸入的數(shù)值異常,請(qǐng)重新輸入");
					i?=?null;
					continue;
				}
			}
				if(!choose.equals("是"))?{
					break;
				}
			
		
			
		}
	}
		
		



}


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

舉報(bào)

0/150
提交
取消

圖書(shū)管理系統(tǒng),有沒(méi)有寫(xiě)的好的答案?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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