System.out.println("歡迎使用達(dá)達(dá)租車(chē)系統(tǒng)");? ? System.out.println("您是否要租車(chē):是1 ? 否0");? ? Scanner input = new Scanner (System.in);? ? int i=input.nextInt();? ? if (i==1){? ? System.out.println("您可租車(chē)的類(lèi)型及其價(jià)目表:");? ? System.out.println("序號(hào)"+"\t"+"汽車(chē)名稱"+"\t"+"租金"+"\t"+"容量");? ? }else{? ? System.out.println("歡迎您再次光臨達(dá)達(dá)租車(chē)系統(tǒng)");? ? }? ? int j;? ? for (j=0;j<6;j++){? ? if (automobileMessenge[j] instanceof Car){? ? System.out.println(automobileMessenge[j].num+"\t"+automobileMessenge[j].name+"\t"? ? +automobileMessenge[j].rent+"元/天"+"\t"+"載人:"+((project7.Car) automobileMessenge[j]).getPeopleCount()+"人");? ? }? ? if (automobileMessenge[j] instanceof Trunk){? ? System.out.println(automobileMessenge[j].num+"\t"+automobileMessenge[j].name+"\t"? ? ? ? +automobileMessenge[j].rent+"元/天"+"\t"+"載貨:"+((project7.Trunk) automobileMessenge[j]).getThingCount()+"噸");? ? }? ? if (automobileMessenge[j] instanceof PickUp){? ? System.out.println(automobileMessenge[j].num+"\t"+automobileMessenge[j].name+"\t"+? ? automobileMessenge[j].rent+"元/天"+"\t"+"載人:"+((project7.PickUp) automobileMessenge[j]).getPeopleCount()? ? ? ? +"載貨:"+((project7.PickUp) automobileMessenge[j]).getThingCount()+"噸");? ? }? ? }? ? System.out.println("請(qǐng)輸入您要租車(chē)的數(shù)量");? ? int carTotal=input.nextInt();? ? int choice []=new int[carTotal];? ? for(j=0;j<carTotal;j++){? ? System.out.println("請(qǐng)輸入第"+""+(j+1)+"輛車(chē)的序號(hào)");? ? choice [j]=input.nextInt();? ? ? }現(xiàn)在想把choice數(shù)組循環(huán)并判斷是能載人的還是載貨的車(chē) 并輸出出來(lái) 實(shí)在沒(méi)思路了
新手java求指導(dǎo)
慕粉1471134825
2017-04-15 13:31:48