import java.awt.Color; import java.util.Random; public class EntityStormtrooper { private int Speed = 0; private float Weight = 0; private Color BodyColor; public float Step; public int getSpeed() { return Speed; } public float getWeight() { return Weight; } public Color getBodyColor() { return BodyColor; } public EntityStormtrooper(int speed, float weight, Color bodyColor){ Random rnd = new Random(); Speed = speed <= 0 ? rnd.nextInt(50 + 1) +50 : speed; //генерация в диапазоне от 50 до 100 Weight = weight <= 0 ? rnd.nextInt(50 + 1) +50 : weight; Step = Speed * 100 / Weight; BodyColor = bodyColor; } }