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数组循环并判断是能载人的还是载货的车 并输出出来 实在没思路了
1 回答
Nirva_Troy
TA贡献2条经验 获得超0个赞
添加回答
举报
0/150
提交
取消