Создание класса-сущности объекта «Электролокомотив»
This commit is contained in:
parent
988f59b7bd
commit
1a57528049
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectricLocomotive
|
||||||
|
{
|
||||||
|
public class EntityElectricLocomotive
|
||||||
|
{
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
public bool Pantograph { get; private set; }
|
||||||
|
public bool RailWay { get; private set; }
|
||||||
|
public bool Compartment { get; private set; }
|
||||||
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация полей объекта-класса локомотива
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес локомотива</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="pantograph">Признак наличия токоприемника</param>
|
||||||
|
/// <param name="railway">Признак наличия железной дороги</param>
|
||||||
|
/// <param name="compartment">Признак наличия отсеков под электрические батареи</param>
|
||||||
|
public void Init(int speed, double weight, Color bodyColor, Color
|
||||||
|
additionalColor, bool pantograph, bool railway, bool compartment)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Pantograph = pantograph;
|
||||||
|
RailWay = railway;
|
||||||
|
Compartment = compartment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user