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.
78 lines
3.0 KiB
78 lines
3.0 KiB
package com.automobile;
|
|
|
|
import com.automobile.model.Car;
|
|
import com.automobile.configuration.ConfigurationSystem;
|
|
import com.automobile.service.ManufacturingSystem;
|
|
import com.automobile.service.MaintenanceSystem;
|
|
|
|
/**
|
|
* 主测试类
|
|
* 用于演示和测试整个汽车系统的功能,包括配置、制造和维修
|
|
*/
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
System.out.println("======= 汽车系统演示 =======\n");
|
|
|
|
// 第一部分:汽车配置系统演示
|
|
System.out.println("\n--------- 1. 汽车配置系统演示 ---------");
|
|
ConfigurationSystem configSystem = new ConfigurationSystem("张三");
|
|
configSystem.startNewConfiguration();
|
|
configSystem.setCarDetails("奔驰", "E级");
|
|
configSystem.configureSteeringWheel("真皮多功能方向盘", true);
|
|
configSystem.configureSeats(5, true, true);
|
|
configSystem.configureEngine(6, 300);
|
|
configSystem.configureTransmission(true, 9);
|
|
configSystem.configureWheels(19.0, "倍耐力");
|
|
|
|
// 第二部分:汽车制造系统演示
|
|
System.out.println("\n--------- 2. 汽车制造系统演示 ---------");
|
|
ManufacturingSystem manufacturingSystem = new ManufacturingSystem("上海汽车制造厂");
|
|
Car car = manufacturingSystem.manufactureCar(configSystem);
|
|
manufacturingSystem.showManufacturingStats();
|
|
|
|
// 第三部分:汽车基本功能测试
|
|
System.out.println("\n--------- 3. 汽车基本功能测试 ---------");
|
|
car.displayInfo();
|
|
car.start();
|
|
car.accelerate(60);
|
|
|
|
// 测试方向盘功能
|
|
car.getSteeringWheel().turn(45);
|
|
car.getSteeringWheel().adjustPosition(50, 10);
|
|
|
|
// 测试座椅功能
|
|
car.getSeats().get(0).adjustPosition(7); // 调整驾驶员座椅
|
|
car.getSeats().get(0).turnOnHeating();
|
|
|
|
// 测试电子系统
|
|
car.getElectronicSystem().runDiagnostics();
|
|
|
|
car.stop();
|
|
|
|
// 第四部分:汽车维修系统演示
|
|
System.out.println("\n--------- 4. 汽车维修系统演示 ---------");
|
|
MaintenanceSystem maintenanceSystem = new MaintenanceSystem("快捷汽修");
|
|
|
|
// 执行常规保养
|
|
maintenanceSystem.performRegularMaintenance(car);
|
|
|
|
// 更换部件
|
|
maintenanceSystem.replaceSteeringWheel(car, "碳纤维方向盘");
|
|
maintenanceSystem.replaceSeat(car, 0, "Nappa真皮", true, true);
|
|
|
|
// 维修引擎
|
|
maintenanceSystem.repairEngine(car, "更换火花塞");
|
|
|
|
// 重置ECU
|
|
maintenanceSystem.resetECU(car, "发动机");
|
|
|
|
// 查看维修历史
|
|
maintenanceSystem.showServiceHistory(car.getVin());
|
|
|
|
// 第五部分:展示汽车最终状态
|
|
System.out.println("\n--------- 5. 汽车最终状态 ---------");
|
|
car.displayInfo();
|
|
|
|
System.out.println("\n======= 演示完成 =======");
|
|
}
|
|
} |