import java.awt.*; public class DrawingEngines implements IDrawingEngines { private EnginesCount enginesCount; private Color color; public DrawingEngines(int count, Color bodyColor) { setCount(count); color = bodyColor; } @Override public void setCount(int count) { if(count <= 2) enginesCount = EnginesCount.Two; else if(count >= 6) enginesCount = EnginesCount.Six; else enginesCount = EnginesCount.Four; } @Override public void setColor(Color color) { this.color = color; } public void draw(Graphics2D g, int startPosX, int startPosY) { g.setPaint(color); g.fillOval(startPosX + 80, startPosY + 10, 30, 15); g.fillOval(startPosX + 80, startPosY + 141, 30, 15); if(enginesCount == EnginesCount.Two) return; g.fillOval(startPosX + 80, startPosY + 30, 30, 15); g.fillOval(startPosX + 80, startPosY + 121, 30, 15); if(enginesCount == EnginesCount.Four) return; g.fillOval(startPosX + 80, startPosY + 50, 30, 15); g.fillOval(startPosX + 80, startPosY + 101, 30, 15); } }