Пример #1
0
        public string DisplayVehicleFullDeatails(string i_LicensePlate)
        {
            StringBuilder vehicleInfo    = new StringBuilder();
            Vehicle       vehicleToCheck = this.m_Vehicle[i_LicensePlate].Vehicle;

            vehicleInfo.Append(string.Format(
                                   @"{6}License Plate: {0}
Model Name: {1}
Owner Name: {2}
Status in garage: {3}
Air pressure in tires: {4}
Tiers manufacturer: {5}
",
                                   vehicleToCheck.LicensePlate,
                                   vehicleToCheck.ModelName,
                                   this.m_Vehicle[i_LicensePlate].OwnerName,
                                   this.m_Vehicle[i_LicensePlate].Status,
                                   vehicleToCheck.TiresList[0].CurrentAirPressure,
                                   vehicleToCheck.TiresList[0].ManufacturerName,
                                   Environment.NewLine));

            if (vehicleToCheck.Energy is FuelEnergy)
            {
                vehicleInfo.Append(string.Format(
                                       @"Fuel Type: {0}
Fuel liters remaining percentage: {1}",
                                       ((FuelEnergy)vehicleToCheck.Energy).FuelType,
                                       vehicleToCheck.Energy.RemainingEnergyPercentage.ToString("0.##\\%")));
            }
            else if (vehicleToCheck.Energy is ElectricEnergy)
            {
                vehicleInfo.Append(string.Format(
                                       @"Battery remaining percentage: {0}", vehicleToCheck.Energy.RemainingEnergyPercentage.ToString("0.##\\%")));
            }

            vehicleInfo.Append(string.Format("{0}{1}", Environment.NewLine, vehicleToCheck.GetUniquePropertiesInfo()));
            return(vehicleInfo.ToString());
        }