package practice;
import java.util.Scanner;
public class Test {
public static void main(String[]args){
LittleCar no1 =new LittleCar(1,"奔驰",1000,5);
LittleCar no2 =new LittleCar(2,"宝马",900,5);
Pikka no3 =new Pikka (3,"福特",200,450,4);
Pikka no4= new Pikka (4,"日产",300,500,4);
Truck no5= new Truck (5,"东风",1200,6000,2);
Truck no6= new Truck (6,"解放",2100,7000,2);
Scanner input=new Scanner(System.in);
boolean temp1=true;
while(temp1){
System.out.println("**********************************************");
System.out.println("欢迎使用本租车系统!");
System.out.println("需要租车请输入1");
System.out.println("不需要请输入2");
int num1=input.nextInt();
System.out.println("**********************************************");
if(num1==1){System.out.println("租用家用轿车请输入1,租用皮卡请输入2,租用货车请输入3,需要租用多种车型请输入4");
break;}
else if(num1==2){
System.out.println("感谢您使用本程序,期待您的下次惠顾!");
System.out.println("**********************************************");
System.exit(0);
}
else {
System.out.println("输入的数字有误,请重新输入!");
}
}
boolean temp2=true;
while(temp2){
int num=input.nextInt();
if(num==1){
System.out.println("****轿车类****");
System.out.println("车辆编号:"+no1.getId()+" "+"车辆品牌:"+no1.getName()+" "+"车辆每日租金:"+no1.getPrice()+"/元/天"+" "+"核定载客人数:"+no1.getSeats()+"人");
System.out.println("车辆编号:"+no2.getId()+" "+"车辆品牌:"+no2.getName()+" "+"车辆每日租金:"+no2.getPrice()+"/元/天"+" "+"核定载客人数:"+no2.getSeats()+"人");
break;
}
else if(num==2){
System.out.println("****皮卡类****");
System.out.println("车辆编号:"+no3.getId()+" "+"车辆品牌:"+no3.getName()+" "+"车辆每日租金:"+no3.getPrice()+"/元/天"+" "+"车辆载货重量:"+no3.getLoadWeight()+"千克"+" "+"核定载客人数:"+no3.getSeats()+"人");
System.out.println("车辆编号:"+no4.getId()+" "+"车辆品牌:"+no4.getName()+" "+"车辆每日租金:"+no4.getPrice()+"/元/天"+" "+"车辆载货重量:"+no4.getLoadWeight()+"千克"+" "+"核定载客人数:"+no4.getSeats()+"人");
break;
}
else if(num==3){
System.out.println("****货车类****");
System.out.println("车辆编号:"+no5.getId()+" "+"车辆品牌:"+no5.getName()+" "+"车辆每日租金:"+no5.getPrice()+"/元/天"+" "+"车辆载货重量:"+no5.getLoadWeight()+"千克"+" "+"核定载客人数:"+no5.getSeats()+"人");
System.out.println("车辆编号:"+no6.getId()+" "+"车辆品牌:"+no6.getName()+" "+"车辆每日租金:"+no6.getPrice()+"/元/天"+" "+"车辆载货重量:"+no6.getLoadWeight()+"千克"+" "+"核定载客人数:"+no6.getSeats()+"人");
break;
}
else if(num==4){
System.out.println("****全部可供出租的车辆信息****");
System.out.println("车辆编号:"+no1.getId()+" "+"车辆品牌:"+no1.getName()+" "+"车辆每日租金:"+no1.getPrice()+"/元/天"+" "+"核定载客人数:"+no1.getSeats()+"人");
System.out.println("车辆编号:"+no2.getId()+" "+"车辆品牌:"+no2.getName()+" "+"车辆每日租金:"+no2.getPrice()+"/元/天"+" "+"核定载客人数:"+no2.getSeats()+"人");
System.out.println("车辆编号:"+no3.getId()+" "+"车辆品牌:"+no3.getName()+" "+"车辆每日租金:"+no3.getPrice()+"/元/天"+" "+"车辆载货重量:"+no3.getLoadWeight()+"千克"+" "+"核定载客人数:"+no3.getSeats()+"人");
System.out.println("车辆编号:"+no4.getId()+" "+"车辆品牌:"+no4.getName()+" "+"车辆每日租金:"+no4.getPrice()+"/元/天"+" "+"车辆载货重量:"+no4.getLoadWeight()+"千克"+" "+"核定载客人数:"+no4.getSeats()+"人");
System.out.println("车辆编号:"+no5.getId()+" "+"车辆品牌:"+no5.getName()+" "+"车辆每日租金:"+no5.getPrice()+"/元/天"+" "+"车辆载货重量:"+no5.getLoadWeight()+"千克"+" "+"核定载客人数:"+no5.getSeats()+"人");
System.out.println("车辆编号:"+no6.getId()+" "+"车辆品牌:"+no6.getName()+" "+"车辆每日租金:"+no6.getPrice()+"/元/天"+" "+"车辆载货重量:"+no6.getLoadWeight()+"千克"+" "+"核定载客人数:"+no6.getSeats()+"人");
break;
}
else{
System.out.println("输入的信息有误,请重新输入!");
}
}
System.out.println("请输入您的姓名:");
String name=input.next();
System.out.println("请输入您的联系方式:");
String PhoneNum=input.next();
boolean temp3=true;
while(temp3){
System.out.println("请输入您想租的车辆的编号");
int CarId=input.nextInt();
System.out.println("请输入您想租用的天数");
int days=input.nextInt();
int TotalPrice;
if(CarId==1){
TotalPrice=1000*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no1.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else if(CarId==2){
TotalPrice=900*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no2.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else if(CarId==3){
TotalPrice=200*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no3.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else if(CarId==4){
TotalPrice=300*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no4.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else if(CarId==5){
TotalPrice=1200*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no5.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else if(CarId==6){
TotalPrice=2100*days;
System.out.println("**********************************************");
System.out.println("顾客姓名:"+name);
System.out.println("顾客联系方式:"+PhoneNum);
System.out.println("租用编号为"+CarId+"的车辆"+" "+no6.getName()+" "+days+"天的总费用为"+TotalPrice+"元人民币");
break;
}
else{
System.out.println("**********************************************");
System.out.println("输入的车辆编码有误,请重新输入!");
}
}
System.out.println("**********************************************");
System.out.println("感谢您在本公司租车,祝您旅途愉快!");
}
}
2025 - 快车库 - 我的知识库 重庆启连科技有限公司 渝ICP备16002641号-10
企客连连 表单助手 企服开发 榜单123