PIbd-23_Dolgov_D.A._Airbus..../EntityAirbus.java

29 lines
715 B
Java
Raw Normal View History

2022-12-05 18:09:08 +04:00
import java.awt.*;
2022-10-17 23:06:21 +04:00
import java.util.Random;
2022-11-21 23:55:09 +04:00
public class EntityAirbus {
2022-12-05 18:09:08 +04:00
private int Speed;
private float Weight;
2022-10-17 23:06:21 +04:00
private Color BodyColor;
public int getSpeed(){return Speed;}
public float getWeight(){return Weight;}
public Color getBodyColor(){return BodyColor;}
public float Step(){return Speed * 100 / Weight;}
2022-12-05 18:09:08 +04:00
public EntityAirbus(int speed, float weight, Color bodyColor)
2022-10-17 23:06:21 +04:00
{
Random rand = new Random();
if (speed <= 0) speed = rand.nextInt(350, 550);
else {
Speed = speed;
};
2022-10-17 23:06:21 +04:00
if (weight <= 0) weight = rand.nextFloat(350, 550);
else {
Weight = weight;
}
2022-10-17 23:06:21 +04:00
BodyColor = bodyColor;
}
}