2023-10-05 21:52:23 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2023-10-06 21:35:14 +04:00
|
|
|
|
namespace RoadTrain.Entities
|
2023-10-05 21:52:23 +04:00
|
|
|
|
{
|
|
|
|
|
public class EntityRoadTrain
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Скорость
|
|
|
|
|
/// </summary>
|
2023-10-06 21:35:14 +04:00
|
|
|
|
public int Speed { get; protected set; }
|
2023-10-05 21:52:23 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Вес
|
|
|
|
|
/// </summary>
|
2023-10-06 21:35:14 +04:00
|
|
|
|
public double Weight { get; protected set; }
|
2023-10-05 21:52:23 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Основной цвет
|
|
|
|
|
/// </summary>
|
2023-10-06 21:35:14 +04:00
|
|
|
|
public Color BodyColor { get; protected set; }
|
2023-11-09 17:11:55 +04:00
|
|
|
|
public void SetBodyColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
BodyColor = color;
|
|
|
|
|
}
|
2023-10-05 21:52:23 +04:00
|
|
|
|
public double Step => (double)Speed * 100 / Weight;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Инициализация полей объекта-класса поезда
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
2023-10-06 21:35:14 +04:00
|
|
|
|
|
|
|
|
|
public EntityRoadTrain(int speed, double weight, Color bodyColor)
|
2023-10-05 21:52:23 +04:00
|
|
|
|
{
|
|
|
|
|
Speed = speed;
|
|
|
|
|
Weight = weight;
|
|
|
|
|
BodyColor = bodyColor;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-06 21:35:14 +04:00
|
|
|
|
}
|