手记

答答租车系统

package com.imooc;
import java.util.Scanner;
public class DDSystem {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    Admin Ad=new Admin();
    Car[] carcrr=new Car[6];
    carcrr[0]=new Auto("奥迪A4",500,4);
    carcrr[1]=new Mzd("马自达6",400,4);
    carcrr[2]=new Pk("皮卡雪6",450,4,2);
    carcrr[3]=new Jl("金龙",800,20);
    carcrr[4]=new Shj("松花江",400,4);
    carcrr[5]=new Ywk("依维柯",1000,20);
    Scanner in=new Scanner(System.in);
    System.out.println("欢迎使用答答租车系统");
    System.out.println("您是否要租车:1是 0否");
    if(in.nextInt()==1){
        System.out.println("您可租车的类型及其价目表:");
        System.out.println("序号"+"\t"+"汽车名称"+"\t"+"租金"+"\t"+"容量");
        for(int i=0;i<6;i++){
            System.out.print((i+1)+"."+"\t");
            carcrr[i].print();
        }
    }
    System.out.println("请输入你要租汽车的数量:");
    int number=in.nextInt();
    int[] one=new int[number];
    for(int i=0;i<number;i++){
        System.out.println("请输入第"+(i+1)+"辆车的序号:");
        one[i]=in.nextInt();
    }
    System.out.println("请输入租车天数:");
    int day=in.nextInt();
    System.out.println("您的账单:");
    System.out.println("****可载人的车有:");
    Ad.Type(one, carcrr);
    System.out.println("****可载货的车有:");
    Ad.Type1(one, carcrr);
    System.out.println("****租车总价格:");
    int sum=Ad.Sum(one);
    System.out.println(day*sum);
}

}

4人推荐
随时随地看视频
慕课网APP