Skip to content

Instantly share code, notes, and snippets.

@evrentan
Created February 19, 2023 14:31
Show Gist options
  • Save evrentan/b5830d0db7e3d9e0bdf11bf632493fa0 to your computer and use it in GitHub Desktop.
Save evrentan/b5830d0db7e3d9e0bdf11bf632493fa0 to your computer and use it in GitHub Desktop.
Main Class for Bridge Design Pattern
import bridge.VehicleManager;
import impl.VehicleImpl;
import java.util.Scanner;
public class BridgeDesignPattern {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the model of your vehicle: ");
final String model = scanner.next();
System.out.print("Enter the manufacture year of your vehicle: ");
final int manufactureYear = scanner.nextInt();
scanner.close();
VehicleManager vehicleManager = new VehicleManager();
vehicleManager.vehicle = new VehicleImpl(manufactureYear, model);
System.out.println(String.format("Your %s is %d years old !!!", vehicleManager.getModel(), vehicleManager.getAge()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment