diff --git a/laba1Loco/EntityTrain.java b/laba1Loco/EntityTrain.java new file mode 100644 index 0000000..c884cec --- /dev/null +++ b/laba1Loco/EntityTrain.java @@ -0,0 +1,39 @@ +package laba1Loco; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.Timer; +import java.awt.event.*; + +public class EntityTrain { + /// + /// Скорость + /// + public int Speed; + /// + /// Вес + /// + public double Weight; + /// + /// Основной цвет + /// + public Color BodyColor; + /// + /// Шаг перемещения поезда + /// + public double Step; + /// + /// Инициализация полей объекта-класса Локомотива + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + public EntityTrain(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + Step = (double)Speed * 100 / Weight; + } +} diff --git a/laba1Loco/Form1.java b/laba1Loco/FormTrain.java similarity index 98% rename from laba1Loco/Form1.java rename to laba1Loco/FormTrain.java index 6ad7e67..1e9ad91 100644 --- a/laba1Loco/Form1.java +++ b/laba1Loco/FormTrain.java @@ -6,7 +6,7 @@ import javax.swing.*; import javax.swing.Timer; import java.awt.event.*; -public class Form1{ +public class FormTrain{ private DrawingLoco _drawingLoco; Canvas canv; @@ -14,7 +14,7 @@ public class Form1{ canv.repaint(); } - public Form1(){ + public FormTrain(){ JFrame w=new JFrame ("Loco"); JButton buttonCreate = new JButton("create"); JButton up = new JButton(); diff --git a/laba1Loco/Main.java b/laba1Loco/Main.java index 21414f2..3367941 100644 --- a/laba1Loco/Main.java +++ b/laba1Loco/Main.java @@ -2,6 +2,6 @@ package laba1Loco; public class Main{ public static void main(String[] args) { - Form1 form1 = new Form1(); + FormTrain formTrain = new FormTrain(); } } \ No newline at end of file diff --git a/laba1Loco/Status.java b/laba1Loco/Status.java new file mode 100644 index 0000000..1bbe051 --- /dev/null +++ b/laba1Loco/Status.java @@ -0,0 +1,7 @@ +package laba1Loco; + +public enum Status { + NotInit, + InProgress, + Finish +}