public abstract class MotoVehicle {
String No =" ";
String brand =" ";
String color;
int Mileage;
int sum;
public abstract int CalcRent(int days);
}
public final class Car extends MotoVehicle {
private String type;
public int CalcRent(int days) {
return 0;
}
public int CalcRent(int days, String type) {
switch (type) {
case "1":
sum = 600 * days;
break;
case "2":
sum = 500 * days;
break;
case "3":
sum = 400 * days;
break;
}
System.out.println("租轿车费用为" + sum);
return sum;
}
}
public final class Bus extends MotoVehicle {
private int setCount;
public Bus(String No, int setCount) {
this.No = No;
this.setCount = setCount;
}
@Override
public int CalcRent(int days) {
return 0;
}
public int CaclRent(int days, int setCount) {
if (setCount <= 16) {
sum = 800 * days;
} else if (setCount > 16) {
sum = 1500 * days;
}
System.out.println("租客车的费用为" + sum);
return sum;
}
}
public class Test111 {
public static void main(String[] args) {
System.out.println("**************欢迎进入腾飞汽车租赁公司**********************");
Scanner input = new Scanner(System.in);
System.out.println("请输入数字选择车型(1.轿车2.客车)");
int num = input.nextInt();
if(num==1) {
System.out.println("别克商务舱GL8");
System.out.println("宝马550i");
System.out.println("别克林荫大道");
System.out.println("请输入数字选择汽车品牌");
String b = input.next();
System.out.println("请输入租赁天数");
int c = input.nextInt();
Car car = new Car();
car.CalcRent(c, b);
}else if(num==2) {
System.out.println("请输入座位数:");
int d = input.nextInt();
System.out.println("请输入租赁天数:");
int e = input.nextInt();
Bus bus = new Bus("0",d);
bus.CaclRent(e, d);
}
}
}