package org.model; public abstract class Vehicle { private String brand; private String model; private int year; private double mileage; public Vehicle(String brand, String model, int year, double mileage) { this.brand = brand; this.model = model; this.year = year; this.mileage = mileage; } public String getBrand() { return this.brand; } public String getModel() { return this.model; } public int getYear() { return this.year; } public double getMileage() { return this.mileage; } public void addMileage(double mileage) { if (mileage < 0) { throw new IllegalArgumentException("Mileage cannot be negative"); } this.mileage += mileage; } public void basicInfo() { System.out.println( year + " " + brand + " " + model + " | Mileage: " + mileage + " | Energy: " + getEnergyType() ); } public abstract void showDetails(); public abstract String getEnergyType(); }