System.out.println("歡迎使用達達租車系統");? ? System.out.println("您是否要租車:是1 ? 否0");? ? Scanner input = new Scanner (System.in);? ? int i=input.nextInt();? ? if (i==1){? ? System.out.println("您可租車的類型及其價目表:");? ? System.out.println("序號"+"\t"+"汽車名稱"+"\t"+"租金"+"\t"+"容量");? ? }else{? ? System.out.println("歡迎您再次光臨達達租車系統");? ? }? ? 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("請輸入您要租車的數量");? ? int carTotal=input.nextInt();? ? int choice []=new int[carTotal];? ? for(j=0;j<carTotal;j++){? ? System.out.println("請輸入第"+""+(j+1)+"輛車的序號");? ? choice [j]=input.nextInt();? ? ? }現在想把choice數組循環并判斷是能載人的還是載貨的車 并輸出出來 實在沒思路了
新手java求指導
慕粉1471134825
2017-04-15 13:31:48