71 lines
2 KiB
C#
71 lines
2 KiB
C#
namespace Transport;
|
|
|
|
/// <summary>
|
|
/// Represents a car
|
|
/// </summary>
|
|
/// <inheritdoc cref="Vehicle" />
|
|
public sealed class Car : Vehicle
|
|
{
|
|
/// <summary>
|
|
/// Name of the worksheet which contains the basic information of all cars
|
|
/// </summary>
|
|
public const string WorksheetName = $"{nameof(Car)}s";
|
|
|
|
private const decimal BaseCostPerKM = 0.8M;
|
|
|
|
private static readonly Dictionary<CarBrand, double> brandCoolness = new()
|
|
{
|
|
// TODO
|
|
};
|
|
|
|
private Car(int id, Color color, int weight, double initialMileage, double power, CarBrand brand)
|
|
: base(id, color, weight, initialMileage)
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the brand of the car
|
|
/// </summary>
|
|
public CarBrand Brand { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the power of the car in kW
|
|
/// </summary>
|
|
public double Power { get; }
|
|
|
|
public override decimal BasePrice => -1; // TODO
|
|
|
|
public override decimal PricePerKM => -1; // TODO
|
|
|
|
public override decimal CostPerKM
|
|
{
|
|
get
|
|
{
|
|
// TODO
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a list of cars by parsing the data from the given worksheet.
|
|
/// Invalid rows are skipped.
|
|
/// </summary>
|
|
/// <param name="worksheet">Worksheet to process</param>
|
|
/// <returns>A list of cars</returns>
|
|
public static List<Car> CreateFromWorksheet(IXLWorksheet worksheet)
|
|
{
|
|
// TODO
|
|
return null!;
|
|
}
|
|
|
|
private bool Equals(Car other) => base.Equals(other) && Brand == other.Brand && Power.Equals(other.Power);
|
|
|
|
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || (obj is Car other && Equals(other));
|
|
|
|
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), (int) Brand, Power);
|
|
|
|
public static bool operator ==(Car? left, Car? right) => Equals(left, right);
|
|
|
|
public static bool operator !=(Car? left, Car? right) => !Equals(left, right);
|
|
}
|