Kharlamov A.A. Lab Work 01 Hard #1

Closed
Kharlamov wants to merge 4 commits from Lab01 into master
Showing only changes of commit 79ad67c00f - Show all commits

33
EntityStormtrooper.java Normal file
View File

@ -0,0 +1,33 @@
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 void Init(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;
}
}