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.

25 lines
1.0 KiB

package com.rental;
public class TestCar {
public static void main(String[] args) {
Car car1 = new Car("XiangA12345", "BYD", "Han EV", 280.0);
Car car2 = new Car("XiangB67890", "Tesla", "Model 3");
Car car3 = new Car("XiangC00001", "Toyota", "Camry", 350.0);
System.out.println("=== Initial Car Information ===");
car1.displayInfo();
car2.displayInfo();
car3.displayInfo();
System.out.println("\n=== Test Rent/Return ===");
car1.rentCar();
car1.rentCar();
car1.returnCar();
car1.returnCar();
System.out.println("\n=== Calculate Rent ===");
double total = car2.calculateRent(5);
System.out.println("car2 5-day rent: " + total);
System.out.println("\n=== Test Invalid Rent ===");
car3.setDailyRent(-100);
System.out.println("car3 rent: " + car3.getDailyRent());
System.out.println("\n=== Total Cars ===");
System.out.println("Total: " + Car.getTotalCars());
}
}