package org; import org.behavior.Serviceable; import org.model.*; import org.util.VehicleInspector; public class Main { public static void main(String[] args) { // ============================================================ // TODO 1: Create vehicle instances // ============================================================ ElectricCar tesla = new ElectricCar( "Tesla", "Model S", 2022, 1000, 5, 100, 75 ); GasCar toyota = new GasCar( "Toyota", "Corolla", 2018, 85000, 5, 50, "Petrol" ); SportsCar ferrari = new SportsCar( "Ferrari", "F8 Tributo", 2021, 12000, 2, 60, "Premium", 2.9 ); HybridCar prius = new HybridCar( "Toyota", "Prius", 2023, 15000, 5, 40, 60 ); // ============================================================ // TODO 2: Create array of Vehicle (polymorphism) // ============================================================ Vehicle[] vehicles = { tesla, toyota, ferrari, prius }; // ============================================================ // TODO 3: Loop through vehicles and print basic info // ============================================================ System.out.println("=== Vehicle Basic Info ==="); for (Vehicle v : vehicles) { v.basicInfo(); System.out.println(); } // ============================================================ // TODO 4: Inspect each vehicle using VehicleInspector // ============================================================ System.out.println("=== Vehicle Inspection ==="); for (Vehicle v : vehicles) { VehicleInspector.inspect(v); System.out.println(); } // ============================================================ // TODO 5: Create array of Serviceable // ============================================================ Serviceable[] serviceables = { tesla, toyota, ferrari, prius }; // ============================================================ // TODO 6: Loop through serviceables and perform service // ============================================================ System.out.println("=== Service Check ==="); for (Serviceable s : serviceables) { Vehicle v = (Vehicle) s; if (s.needsService(v)) { System.out.println(v.getBrand() + " " + v.getModel() + " needs service:"); s.performService(); } else { System.out.println(v.getBrand() + " " + v.getModel() + " does not need service."); } System.out.println(); } // ============================================================ // TODO 7: Final message // ============================================================ System.out.println("=== Workshop Completed ==="); } }