Пример #1
0
        internal Wheel(Dictionary <string, string> i_VehicleProperties)
        {
            m_ManufacturerName = i_VehicleProperties["Wheels manufacturer name"];
            m_MaxPSI           = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels Maximum PSI amount"]);
            m_CurrentPSI       = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels current PSI amount"]);

            if (m_CurrentPSI > m_MaxPSI)
            {
                throw new ValueOutOfRangeException(0, m_MaxPSI);
            }
        }
Пример #2
0
        public bool ChangeVehicleStatus(string i_LicenseNum, string i_NewStatus)
        {
            if (!CheckIfInGarage(i_LicenseNum))
            {
                throw new ArgumentException("Vehicle is not in our garage");
            }
            Vehicle toChange;
            bool    statusChanged = m_VehiclesInTheGarage.TryGetValue(i_LicenseNum, out toChange);

            Vehicle.StatusOfVehicle newStatus = FieldsChecker.CheckValidStatus(i_NewStatus);
            toChange.VehicleStatus = newStatus;

            return(statusChanged);
        }
Пример #3
0
 internal EnergySource(Dictionary <string, string> i_VehicleProperties)
 {
     if (i_VehicleProperties["Type of energy"] == "Fuel")
     {
         m_MaxEnergy  = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum fuel capacity"]);
         m_EnergyLeft = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Current fuel amount"]);
         if (m_MaxEnergy < m_EnergyLeft)
         {
             throw new ArgumentException("The amount of fuel is over the limit.");
         }
     }
     else  // It is a electric battery source
     {
         m_MaxEnergy  = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum battery capacity"]);
         m_EnergyLeft = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Current battery status"]);
         if (m_MaxEnergy < m_EnergyLeft)
         {
             throw new ArgumentException("The battery reached its limit.");
         }
     }
 }
Пример #4
0
 public MotorBike(Dictionary <string, string> i_VehicleProperties)
     : base(i_VehicleProperties)
 {
     m_LicenseType    = FieldsChecker.CheckValidLicense(i_VehicleProperties["License type"]);
     m_EngineCapacity = FieldsChecker.StringProperyToInt(i_VehicleProperties["Engine capacity"]);
 }
Пример #5
0
 internal Car(Dictionary <string, string> i_VehicleProperties)
     : base(i_VehicleProperties)
 {
     m_ColorOfCar    = FieldsChecker.CheckValidColor(i_VehicleProperties["Color of car"]);
     m_NumberOfDoors = FieldsChecker.CheckValidNumberOfDoors(i_VehicleProperties["Number of doors"]);
 }
Пример #6
0
 internal Fuel(Dictionary <string, string> i_VehicleProperties)
     : base(i_VehicleProperties)
 {
     m_FuelType = FieldsChecker.CheckValidFuelType(i_VehicleProperties["Fuel type"]);
 }
Пример #7
0
 public Truck(Dictionary <string, string> i_VehicleProperties)
     : base(i_VehicleProperties)
 {
     m_HasDeadlyMaterials = FieldsChecker.ValidationOfDangerousAnswer(i_VehicleProperties["Does carry dangerous materials?"]);
     m_MaxWeightAllowed   = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum weight allowed"]);
 }
Пример #8
0
 internal Wheel(Dictionary <string, string> i_VehicleProperties)
 {
     m_ManufacturerName = i_VehicleProperties["Wheels manufacturer name"];
     m_CurrentPSI       = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels current PSI amount"]);
     m_MaxPSI           = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels Maximum PSI amount"]);
 }