Pibd-22_Presnyakova.V.V_Cat.../EntityBoat.java

33 lines
703 B
Java
Raw Normal View History

2022-12-05 00:55:23 +04:00
import java.awt.*;
import java.util.Random;
public class EntityBoat {
private int Speed;
public int GetSpeed() {
return Speed;
}
private float Weight;
public float GetWeight() {
return Weight;
}
private Color BodyColor;
public Color GetBodyColor() {
return BodyColor;
}
2022-12-05 02:29:28 +04:00
2022-12-05 00:55:23 +04:00
public float Step;
2022-12-05 02:29:28 +04:00
public float GetStep(){return Step;}
2022-12-05 00:55:23 +04:00
2022-12-05 02:29:28 +04:00
public EntityBoat(int speed, float weight, Color bodyColor)
2022-12-05 00:55:23 +04:00
{
Random rnd = new Random();
Speed = speed <= 0 ? rnd.nextInt(10,30) : speed;
Weight = weight <= 0 ? rnd.nextInt(40,70) : weight;
BodyColor = bodyColor;
Step = Speed * 100 / (int)Weight;
}
}