不多说直接上源代码package 哒哒租车系统;
import java.util.Scanner;
public class Initail {
public static void Welcome(){
System.out.println("欢迎来到哒哒租车,请问您是否需要租车?");
System.out.println("A、是,B、不是");
Scanner s=new Scanner(System.in);
String link = s.nextLine();
if(link.equals("A")){
System.out.println("正在进入浏览界面,请稍等……");
Xuanche();
}else if(link.equals("B")){
System.out.println("正在启动爆炸系统,请稍后……");
}else{
System.out.println("输入了无效的数值,请重新输入!");
Welcome();
}
}
public static void Xuanche(){
Car car = new Car();
ACar car1 = new AoDiA4();
ACar car2 = new MaZiDa6();
ACar car3 = new PiKaXue6();
ACar car4 = new JingLong();
ACar car5 = new Sonhuajiang();
ACar car6 = new YiWeiKe();
PiKaXue6 car7 = new PiKaXue6();
car.car();
car1.size();car1.aclass();car1.money();car1.manay();
car2.size();car2.aclass();car2.money();car2.manay();
car3.size();car3.aclass();car3.money();car3.manay();car7.huowu();
car4.size();car4.aclass();car4.money();car4.manay();
car5.size();car5.aclass();car5.money();car5.manay();
car6.size();car6.aclass();car6.money();car6.manay();
Shuliang();
}
public static void Shuliang(){
System.out.println("请输入您需要租用的车的数量!");
Scanner s =new Scanner(System.in);
int i = s.nextInt();
int[] num=new int[]{};
if( i == 7 ){
System.out.println("您好,您所输入的数值无效,我们没有那么多的车辆供您使用!请重新输入!");
Shuliang();
}else if(i < 7){
System.out.println("输入了有效数值,正在为你载入……");
for(int j=1;j<=i;j++){
System.out.println("请输入您所要选择的"+j+"辆车的序号");
Scanner num1 = new Scanner(System.in);
int x=num1.nextInt();
if(x==1){
ACar car1 = new AoDiA4();
car1.size();car1.aclass();car1.money();car1.manay();
}else if(x==2){
ACar car2 = new MaZiDa6();
car2.size();car2.aclass();car2.money();car2.manay();
}else if (x==3){
ACar car3 = new PiKaXue6();PiKaXue6 car7 = new PiKaXue6();
car3.size();car3.aclass();car3.money();car3.manay();car7.huowu();
}else if (x==4){
ACar car4 = new JingLong();
car4.size();car4.aclass();car4.money();car4.manay();
}else if (x==5){
ACar car5 = new Sonhuajiang();
car5.size();car5.aclass();car5.money();car5.manay();
}else if (x==6){
ACar car6 = new YiWeiKe();
car6.size();car6.aclass();car6.money();car6.manay();
}else{
System.out.println("您的输入错误,请重新输入。");
Shuliang();
}
System.out.println("请输入借用天数:");
Scanner day =new Scanner(System.in);
int time = day.nextInt();
int sum = 0 ;
ACar car1 = new AoDiA4();
ACar car2 = new MaZiDa6();
ACar car3 = new PiKaXue6();
ACar car4 = new JingLong();
ACar car5 = new Sonhuajiang();
ACar car6 = new YiWeiKe();
PiKaXue6 car7 = new PiKaXue6();
for(int qian=0;qian<=j;qian++){
sum =time *= car + x.money;;
}
System.out.println("您需要花费"+sum+"元来借用这些车辆!");
}
}else{
System.out.println("输入了无效的值,请重新输入1-7之间的数值。");
Shuliang();
}
}
public static void main(String[] args){
Welcome();
}
} for(int qian=0;qian<=j;qian++){
sum =time *= car + x.money;;
}问题的关键是这里要如何使他自动的分析并带入car(x).money(这段话是为了描述,实质上是写不出来的)
添加回答
举报
0/150
提交
取消