Borschevskaya A.A. Lab Work 2 Hard #2

Merged
eegov merged 16 commits from lab2 into lab1 2022-11-07 10:48:13 +04:00
3 changed files with 4 additions and 6 deletions
Showing only changes of commit b74e5b9fba - Show all commits

@ -22,9 +22,8 @@ public class DrawingArmoredCar {
return armoredCar;
}
public void Init(int speed, float weight, Color bodyColor) {
this.armoredCar = new EntityArmoredCar();
this.armoredCar.init(speed, weight, bodyColor);
public DrawingArmoredCar(int speed, float weight, Color bodyColor) {
this.armoredCar = new EntityArmoredCar(speed, weight, bodyColor);
Random r = new Random();
this.drawingCaterpillar = new DrawingCaterpillar();
Review

Требовалось создание объекта, а не массива объектов

Требовалось создание объекта, а не массива объектов
this.drawingCaterpillar.Init(r.nextInt(4, 7), bodyColor);

@ -7,7 +7,7 @@ public class EntityArmoredCar {
private Color bodyColor;
public float step;
public void init(int speed, float weight, Color bodyColor) {
public EntityArmoredCar(int speed, float weight, Color bodyColor) {
this.speed = speed;
this.weight = weight;
this.bodyColor = bodyColor;

@ -42,8 +42,7 @@ public class FormArmoredCar extends JFrame{
@Override
public void actionPerformed(ActionEvent actionEvent) {
Random rnd = new Random();
armoredCar = new DrawingArmoredCar();
armoredCar.Init(rnd.nextInt(100,300), rnd.nextInt(1000, 2000),
armoredCar = new DrawingArmoredCar(rnd.nextInt(100,300), rnd.nextInt(1000, 2000),
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
armoredCar.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),