package dada;
import java.util.Scanner;
public class zuche {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("欢迎使用答答租车系统");
System.out.println("您是否要租车:1是 0否");
Scanner input=new Scanner(System.in);
int num=input.nextInt();
if(num==1){
System.out.println("");
}else{
return;//退出
}
car car1=new keche("奥迪A4");
car car2=new keche("马自达6");
car car3=new pika("皮卡雪6");
car car4=new keche("金龙");
car car5=new kache("松花江");
car car6=new kache("依维柯");
String cars[] = {"奥迪A4","马自达6","皮卡雪6","金龙","松花江","依维柯"};
int huo[] = {0,0,2,0,4,20,};//将载货数输入数组
int ren[] = {4,4,4,20,0,0};//将载人数输入数组
int money[] = {500,400,450,800,400,1000};
System.out.println("您可租车的类型及价目表:");
System.out.println("序号 汽车名称 租金 容量");
System.out.println("1. 奥迪A4 500元/天 载人:4人");
System.out.println("2. 马自达6 400元/天 载人:4人");
System.out.println("3. 皮卡雪6 450元/天 载人:4人,载货:2吨");
System.out.println("4. 金龙 800元/天 载人:20人");
System.out.println("5. 松花江 400元/天 载货:4吨");
System.out.println("6. 依维柯 1000元/天 载货:20吨");
System.out.println("请输入您租车的数量");
int cheshu=input.nextInt();
int $ =0 ;
for(int i=1;i<cheshu+1;i++){
System.out.println("请输入第"+i+"辆车的序号");
int xuhao=input.nextInt();
System.out.println("第"+i+"辆车的名称是");
System.out.println(cars[xuhao-1]);
System.out.println("第"+i+"辆车的载人数");
System.out.println(ren[xuhao-1]);
System.out.println("第"+i+"辆车的载货数");
System.out.println(huo[xuhao-1]);
$ = $ + money[xuhao-1];
}
System.out.println("请输入您租车的天数");
int tian=input.nextInt();
System.out.println("您的总租金为");
System.out.println($*tian);
}
}
package dada;
public class pika extends car {
public pika(String name) {
super(name);
this.name =name;
}
}
package dada;
public class keche extends car {
public keche(String name) {
super(name);
this.name =name;
}
}
package dada;
public class kache extends car {
public kache(String name) {
super(name);
this.name =name;
}
}
package dada;
public class car {
public String name;//车名
public car(String name) {
this.name =name;
}
}