Exemple #1
0
        public override string ToString()
        {
            StringBuilder vehicleDetails = new StringBuilder();
            List <Wheel>  wheelsDetails  = VehicleWheels;

            vehicleDetails.Append(string.Format("License Plate: {0}{1}", LicensePlate, Environment.NewLine));
            vehicleDetails.Append(string.Format("Vehicle Model: {0}{1}", Model, Environment.NewLine));
            int wheelNum = 1;

            foreach (Wheel wheel in wheelsDetails)
            {
                vehicleDetails.Append(string.Format("Wheel Number {0}: {1}{2}", wheelNum, wheel.ToString(), Environment.NewLine));
                ++wheelNum;
            }

            if (VehicleEngine is GasEngine)
            {
                vehicleDetails.Append(VehicleEngine.ToString());
                vehicleDetails.Append(Environment.NewLine);
            }

            vehicleDetails.Append(string.Format("Current Energy Percentage: {0}", CurrentEnergyPercentage));
            vehicleDetails.Append(Environment.NewLine);

            return(vehicleDetails.ToString());
        }
Exemple #2
0
 public override void UpdateProperties(Dictionary <Vehicle.eProperties, string> i_VehiclePropertiesValues, List <string> i_WheelsMakers, List <float> i_WheelsAirPressure)
 {
     base.UpdateProperties(i_VehiclePropertiesValues, i_WheelsMakers, i_WheelsAirPressure);
     ContainDangerousMaterials = i_VehiclePropertiesValues[eProperties.IsDangerousMaterials].Equals('Y') ? true : false;
     CargoVolume = float.Parse(i_VehiclePropertiesValues[eProperties.CargoVolume]);
     VehicleEngine.UpdateProperties(i_VehiclePropertiesValues, CurrentEnergyPercentage);
 }
Exemple #3
0
 public override void UpdateProperties(Dictionary <Vehicle.eProperties, string> i_VehiclePropertiesValues, List <string> i_WheelsMakers, List <float> i_WheelsAirPressure)
 {
     base.UpdateProperties(i_VehiclePropertiesValues, i_WheelsMakers, i_WheelsAirPressure);
     DrivingLicenseType = StringToEnum <eDrivingLicenseType>(i_VehiclePropertiesValues[eProperties.LicenseType]);
     EngineVolume       = int.Parse(i_VehiclePropertiesValues[eProperties.EngineVolume]);
     VehicleEngine.UpdateProperties(i_VehiclePropertiesValues, CurrentEnergyPercentage);
 }
Exemple #4
0
 public override void UpdateProperties(Dictionary <Vehicle.eProperties, string> i_VehiclePropertiesValues, List <string> i_WheelsMakers, List <float> i_WheelsAirPressure)
 {
     base.UpdateProperties(i_VehiclePropertiesValues, i_WheelsMakers, i_WheelsAirPressure);
     CarColor    = StringToEnum <eCarColors>(i_VehiclePropertiesValues[eProperties.Color]);
     DoorsNumber = StringToEnum <eDoorsNumber>(i_VehiclePropertiesValues[eProperties.Doors]);
     VehicleEngine.UpdateProperties(i_VehiclePropertiesValues, CurrentEnergyPercentage);
 }
Exemple #5
0
        public void FillEnergy(float i_EnergyAmount, Engine.eFuelType?i_FuelType = null)
        {
            if (VehicleEngine is GasEngine && i_FuelType != (VehicleEngine as GasEngine).FuelType)
            {
                if (i_FuelType == null)
                {
                    throw new ArgumentException("No fuel type recived");
                }
                else
                {
                    throw new ArgumentException("Fuel type not match");
                }
            }

            VehicleEngine.FillEnergy(i_EnergyAmount, this, i_FuelType);
        }
Exemple #6
0
 public Vehicle(
     OwnerInfo i_Owner,
     string i_ModelName,
     string i_LicenseNumber,
     float i_MaxEnergyCapacity,
     float i_MaxAirPressure,
     byte i_NumOfWheels,
     eEngineTypes i_EngineType)
 {
     r_LicenseNumber  = i_LicenseNumber;
     r_Model          = i_ModelName;
     r_NumOfWheels    = i_NumOfWheels;
     r_MaxAirPressure = i_MaxAirPressure;
     allocateWheels();
     m_Engine            = new VehicleEngine(i_MaxEnergyCapacity, i_EngineType);
     m_Status            = eVehicleStatus.BeingFixed;
     m_Owner.Name        = i_Owner.Name;
     m_Owner.PhoneNumber = i_Owner.PhoneNumber;
 }