Exemple #1
0
        public string GetAllDetalies()
        {
            return(string.Format(@"
License Type:{0}
Engine Volume:{1}",
                                 LicenseType.ToString(), m_EngineVolume.ToString()));
        }
Exemple #2
0
        public override void CheckAndUpdateInformation(string i_InputToCheck, int i_MemberIndex)
        {
            int firstMotorcycleMembers = (int)Enum.GetValues(typeof(eMotorcycleMembers)).Cast <eMotorcycleMembers>().First();

            if (i_MemberIndex < firstMotorcycleMembers)
            {
                CheckAndUpdateVehicleInformation(i_InputToCheck, i_MemberIndex);
            }
            else
            {
                eMotorcycleMembers memberToCheck = (eMotorcycleMembers)i_MemberIndex;
                switch (memberToCheck)
                {
                case eMotorcycleMembers.LicenseType:
                {
                    _LicenseType = LicenseType.ParseFromString(i_InputToCheck);
                    break;
                }

                case eMotorcycleMembers.EngineVolume:
                {
                    EngineVolume = int.Parse(i_InputToCheck);
                    break;
                }
                }
            }
        }
        public static LicenseType Parse(string i_LicenseTypeAsStr)
        {
            eLicenseType licenseTypeToSet = eLicenseType.A;

            if (i_LicenseTypeAsStr == "1" || i_LicenseTypeAsStr == "A" || i_LicenseTypeAsStr == "a")
            {
                licenseTypeToSet = eLicenseType.A;
            }
            else if (i_LicenseTypeAsStr == "2" || i_LicenseTypeAsStr == "AB" || i_LicenseTypeAsStr == "Ab" || i_LicenseTypeAsStr == "aB" || i_LicenseTypeAsStr == "ab")
            {
                licenseTypeToSet = eLicenseType.AB;
            }
            else if (i_LicenseTypeAsStr == "3" || i_LicenseTypeAsStr == "A2" || i_LicenseTypeAsStr == "a2")
            {
                licenseTypeToSet = eLicenseType.A2;
            }
            else if (i_LicenseTypeAsStr == "4" || i_LicenseTypeAsStr == "B1" || i_LicenseTypeAsStr == "b1")
            {
                licenseTypeToSet = eLicenseType.B1;
            }
            else if (i_LicenseTypeAsStr != "1" && i_LicenseTypeAsStr != "A" && i_LicenseTypeAsStr != "a")
            {
                throw new FormatException();
            }

            LicenseType licenseType = new LicenseType();

            licenseType.m_LicenseType = licenseTypeToSet;

            return(licenseType);
        }
        public override string ToString()
        {
            string DataOfMotorcycle;

            DataOfMotorcycle = string.Format("License Type: {0}{3}" +
                                             "Engine Volume In Cc: {1}{3}" +
                                             "Number Of Wheels: {2}{3}", LicenseType.ToString(), EngineVolumeInCc.ToString()
                                             , MotorcycleNumOfWheels.ToString(), Environment.NewLine);

            return(DataOfMotorcycle + base.ToString());
        }
        public override string ToString()
        {
            string motorcycle = string.Format(
                "{0}The motorcycle license type is {1} and his engine capacity is {2} CC{3}",
                base.ToString(),
                LicenseType.ToString(),
                EngineCapacityInCC,
                Environment.NewLine);

            return(motorcycle);
        }
Exemple #6
0
 public Motorcycle(
     ref Client i_Owner,
     VehicleType i_Type,
     string i_ModelName,
     string i_LicenseNumber,
     ref EnergySystem i_EnergySystem,
     short i_WheelsNumber,
     ref List <Wheel> i_VehicleWheels,
     int i_EngineCapacity,
     LicenseType i_LicenseType) :
     base(ref i_Owner, i_Type, i_ModelName, i_LicenseNumber, ref i_EnergySystem, i_WheelsNumber, ref i_VehicleWheels)
 {
     this.m_EngineCapacity = i_EngineCapacity;
     this.m_LicenseType    = i_LicenseType;
 }
Exemple #7
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"]);
 }
 public MotorcycleProperties(int i_EngineCapacity, LicenseType i_LicenseType)
 {
     m_EngineCapacity = i_EngineCapacity;
     m_LicenseType    = i_LicenseType;
 }
Exemple #9
0
 public override void SetSpecificProperties(string[] i_SpecificProperties)
 {
     m_LicenseType  = LicenseType.Parse(i_SpecificProperties[0]);
     m_EngineVolume = int.Parse(i_SpecificProperties[1]);
 }