package com.rentsystem;
import java.util.Scanner;
public class Initail {
public static void main(String[] args) {
//定义系统内车辆信息
Car [] car = new Car[10];
car[0]= new PessCar("奥迪A4",500,4);
car[1]= new PessCar("马自达6",400,4);
car[2]= new PessCar("金龙 ",800,20);
car[3]= new PickUp("皮卡雪6",450,5,2);
car[4]= new Truck("松花江",400,4);
car[5]= new Truck("依维柯",1000,20);
System.out.println("*****************************************************");
System.out.println("欢迎使用哒哒租车系统");
System.out.println("您是否要租车?输入1选择是,输入其他数值选择否:");
//设置变量num01接受第一次输入的数据
Scanner input = new Scanner(System.in);
int num01 = input.nextInt();
//建立外部循环语句进行初步判断
if(num01==1){
System.out.println("*****************************************************");
System.out.println("您的可租车型如下表所示:");
System.out.println("序号"+"\t车辆名"+"\t租金"+"\t载重");
//遍历所有车辆信息并显示
for(int i =0;i<=6;i++){
System.out.println((i+1)+"\t"+car[i].print());
}
//建立循环语句选择租车信息
System.out.println("请输入您的租车数量:");
int num02=input.nextInt();
int amount=0;//总租金
int count=0;//总载客量
float load=0;//总载货量
String [] carname = new String[num02];
for (int j=0;j<=num02;j++){
int n=j+1;
System.out.println("请输入第"+n+"辆车的序号");
Car[]choose=new Car[num02];
choose[j]=car[input.nextInt()-1];
amount = amount + choose[j].rent;
count = count + choose[j].cargoP;
load = load + choose[j].cargoT;
}
System.out.println("请选择租车天数:");
int day = input.nextInt();
int finalamount = amount*day;
System.out.println("您的帐单如下:");
System.out.println("总租金:"+finalamount);
}
else{
System.out.println("欢迎使用哒哒租车系统,再见!");
}
}
}