47 lines
1.4 KiB
Java
47 lines
1.4 KiB
Java
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;
|
||
|
||
public void setBodyColor(Color color){BodyColor = color;}
|
||
/// <summary>
|
||
/// Шаг перемещения поезда
|
||
/// </summary>
|
||
public double Step;
|
||
/// <summary>
|
||
/// количество колёс [2;4]
|
||
/// </summary>
|
||
public int numWheel;
|
||
/// <summary>
|
||
/// Инициализация полей объекта-класса Локомотива
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">Вес автомобиля</param>
|
||
/// <param name="bodyColor">Основной цвет</param>
|
||
public EntityTrain(int speed, double weight, Color bodyColor, int _numWheel)
|
||
{
|
||
Speed = speed;
|
||
Weight = weight;
|
||
BodyColor = bodyColor;
|
||
numWheel = _numWheel;
|
||
Step = (double)Speed * 100 / Weight;
|
||
}
|
||
}
|