2023-10-07 21:04:33 +04:00
|
|
|
|
package laba1Loco;
|
|
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import javax.swing.Timer;
|
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
|
|
|
|
|
public class EntityTrain {
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Скорость
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Speed;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Вес
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double Weight;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Основной цвет
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Color BodyColor;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Шаг перемещения поезда
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double Step;
|
|
|
|
|
/// <summary>
|
2023-10-08 01:10:54 +04:00
|
|
|
|
/// количество колёс [2;4]
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int numWheel;
|
|
|
|
|
/// <summary>
|
2023-10-07 21:04:33 +04:00
|
|
|
|
/// Инициализация полей объекта-класса Локомотива
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес автомобиля</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
2023-10-08 01:10:54 +04:00
|
|
|
|
public EntityTrain(int speed, double weight, Color bodyColor, int _numWheel)
|
2023-10-07 21:04:33 +04:00
|
|
|
|
{
|
|
|
|
|
Speed = speed;
|
|
|
|
|
Weight = weight;
|
|
|
|
|
BodyColor = bodyColor;
|
2023-10-08 01:10:54 +04:00
|
|
|
|
numWheel = _numWheel;
|
2023-10-07 21:04:33 +04:00
|
|
|
|
Step = (double)Speed * 100 / Weight;
|
|
|
|
|
}
|
|
|
|
|
}
|