You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
package w4;
|
|
|
|
|
|
public class TestCar {
|
|
public static void main(String[] args) {
|
|
Car car1 = new Car("京A12345", "丰田", "凯美瑞", 450.0);
|
|
Car car2 = new Car("沪B67890", "大众", "帕萨特");
|
|
Car car3 = new Car("粤C54321", "宝马", "3系", 680.0);
|
|
|
|
System.out.println("=====初始车辆信息=====");
|
|
car1.displayInfo();
|
|
car2.displayInfo();
|
|
car3.displayInfo();
|
|
|
|
|
|
System.out.println("=====测试租车还车=====");
|
|
car1.rentCar();
|
|
car1.rentCar();
|
|
car1.returnCar();
|
|
car1.returnCar();
|
|
System.out.println();
|
|
|
|
|
|
System.out.println("=====计算5天租金=====");
|
|
double rent = car2.calculateRent(5);
|
|
System.out.println("车辆2租用5天总费用:" + rent + "元\n");
|
|
|
|
|
|
System.out.println("=====测试非法修改租金=====");
|
|
car3.setDailyRent(-100);
|
|
System.out.println();
|
|
|
|
System.out.println("=====车辆总数统计=====");
|
|
System.out.println("系统中总车辆数:" + Car.getTotalCars());
|
|
}
|
|
}
|
|
|