qq_宇_35
2017-08-05 15:50
package dadadache; import java.util.Scanner; import java.util.ArrayList; public class Inital { public static void main(String[] args) { // TODO Auto-generated method stub int sumperson=0; int sumload=0; int sumpay=0; ArrayList<String>personcars=new ArrayList<String>(); ArrayList<String>loadcars=new ArrayList<String>(); car[] cars={new passagecar(1,"雪铁龙",5,0,90),new car(2,"五菱",5,6,60),new loadcar(3,"皮卡",0,18,50),new car(4,"奔驰",4,4,120),new loadcar(5,"大众",0,18,50)}; Scanner in=new Scanner(System.in); System.out.println("********欢迎进入哒哒打车系统************"); System.out.println("******是否确认进入系统1.是 2.否********"); if(in.nextInt()==2){ System.exit(0); }else{ System.out.println("序号"+'\t'+"车型"+'\t'+"载人数"+'\t'+"载物数"+'\t'+"租金"); for(car c:cars){ System.out.println(c); } /*for(int j=0;j<5;j++){ System.out.println(cars[j].toString()); }*/ System.out.println("*************请输入需要车辆数*********"); int date=in.nextInt(); for(int i=1;i<=date;i++){ System.out.println("*****请输入第"+i+"辆车的序号"); int s=in.nextInt(); if(s==10||s==11||s==13){ personcars.add(cars[i].name);} if(s!=10){ loadcars.add(cars[i].name);} sumperson+=cars[s-10].person; sumload+=cars[s-10].ton; sumpay+=cars[s-10].pay; } System.out.println("*****请输入要租的天数******"); int d=in.nextInt(); sumperson*=d; sumload*=d; sumpay*=d; System.out.println("******您的帐单*********"); System.out.println("载客车辆有:"+personcars); System.out.println("总载客量:"+sumperson); System.out.println("载货车辆有"+loadcars); System.out.println("总载重重量"+sumload); System.out.println("总租金"+sumpay);} }}
if(s==10||s==11||s==13){
personcars.add(cars[i].name);}
if(s!=10){
loadcars.add(cars[i].name);}
sumperson+=cars[s-10].person;
sumload+=cars[s-10].ton;
sumpay+=cars[s-10].pay;
}
大神,你这一段的判断条件是什么意思?没看懂啊
Java入门第二季 升级版
530646 学习 · 6091 问题
相似问题