import java.awt.*; import java.util.Random; public class EnginesFabric { public static IDrawingEngines createRandom(Color color) { Random rnd = new Random(); int type = rnd.nextInt(0, 3); return switch(type) { case 0 -> new DrawingEngines(rnd.nextInt(1, 7), color); case 1 -> new DrawingWavyEngines(rnd.nextInt(1, 7), color); case 2 -> new DrawingTruncatedEngines(rnd.nextInt(1, 7), color); default -> null; }; } }