import java.awt.*; import java.util.Random; // Класс-сущность "Трактор" public class EntityTracktor { private int Speed; private float Weight; private Color BodyColor; public int getSpeed() { return Speed; } public float getWeight(){ return Weight; } public Color getBodyColor(){ return BodyColor; } public float getStep(){ return Speed * 100 / Weight; } // Инициализация полей объекта-класса Трактора public EntityTracktor(int speed, float weight, Color bodyColor) { Random rnd = new Random(); Speed = speed <= 0 ? rnd.nextInt(50, 150) : speed; Weight = weight <= 0 ? rnd.nextInt(40, 70) : weight; BodyColor = bodyColor; } }