码迷,mamicode.com
首页 > 编程语言 > 详细

java汽车租赁源码

时间:2016-08-08 19:18:21      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:

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);


}
}

}

java汽车租赁源码

标签:

原文地址:http://www.cnblogs.com/wangdesheng1123/p/5750496.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!