예제 #1
0
파일: Truck.cs 프로젝트: ofiriro3/C-ex1
 public Truck(string i_ModuleName, string i_LicensePlate, bool i_CarriesToxic, float i_MaxCarryWeight,
              List <Wheel> i_Wheels, PowerSource i_PowerSource)
     : base(i_ModuleName, i_LicensePlate, i_Wheels, i_PowerSource, 12)
 {
     m_CarriesToxic   = i_CarriesToxic;
     m_MaxCarryWeight = i_MaxCarryWeight;
 }
예제 #2
0
 public Motorcycle(string i_ModuleName, string i_LicensePlate, eLicenceType i_LicenceType,
                   int i_EngineVolume, List <Wheel> i_Wheels, PowerSource i_PowerSource)
     : base(i_ModuleName, i_LicensePlate, i_Wheels, i_PowerSource, 2)
 {
     m_LicenceType  = i_LicenceType;
     m_EngineVolume = i_EngineVolume;
 }
예제 #3
0
 public Vehicle(string i_ModuleName, string i_LicensePlate, List <Wheel> i_Wheels, PowerSource i_PowerSource, int i_NumberOfWheels)
 {
     m_ModuleName     = i_ModuleName;
     m_LicensePlate   = i_LicensePlate;
     m_Wheels         = i_Wheels;
     m_PowerSource    = i_PowerSource;
     r_NumberOfWheels = i_NumberOfWheels;
 }
예제 #4
0
        protected Vehicle(string i_ModelName, string i_LicenseNumber, Wheel i_Wheel, int i_NumOfWheels, eVehicleStatus i_eStatus, PowerSource m_PowerSource)
        {
            this.r_ModelName     = i_ModelName ?? throw new ArgumentNullException(nameof(r_ModelName));
            this.r_LicenseNumber = i_LicenseNumber ?? throw new ArgumentNullException(nameof(r_LicenseNumber));
            this.m_Status        = i_eStatus;
            this.m_PowerSource   = m_PowerSource ?? throw new ArgumentNullException(nameof(m_PowerSource));
            m_VehicleWheels      = new List <Wheel>();

            for (int i = 0; i < i_NumOfWheels; i++)
            {
                m_VehicleWheels.Add(i_Wheel);
            }
        }
예제 #5
0
        public Vehicle(string i_ModelName, string i_LicenseNumber, float i_RemainingPowerSupply, PowerSource.ePowerSupply i_VehiclePowerSource)
        {
            this.r_Model            = i_ModelName;
            this.r_LicenseNumber    = i_LicenseNumber;
            this.m_EnergyPercentage = i_RemainingPowerSupply;
            this.m_Wheels           = new List <Wheel>();

            r_VehiclesList.Add(this);

            if (i_VehiclePowerSource == PowerSource.ePowerSupply.Battery)
            {
                m_VehiclePowerSource = new Battery();
            }
            else
            {
                m_VehiclePowerSource = new Fuel();
            }
        }
예제 #6
0
        public override string ToString()
        {
            string details = string.Format(
                @"License Number: {0}
Model: {1}
Power type: {2}. Current power state: {3}
Vehicle status: {4}
Wheel info: {5}
",
                r_LicenseNumber,
                r_ModelName,
                PowerSource.ToString(),
                PowerSource.CurrAmount,
                VehicleStatus.ToString(),
                m_VehicleWheels[0].ToString());

            return(details);
        }
예제 #7
0
파일: Car.cs 프로젝트: ofiriro3/C-ex1
 public Car(string i_ModuleName, string i_LicensePlate, eColor i_Color, eNumberOfDoors i_NumberOfDoors, List <Wheel> i_Wheels, PowerSource i_PowerSource)
     : base(i_ModuleName, i_LicensePlate, i_Wheels, i_PowerSource, 4)
 {
     m_Color         = i_Color;
     m_NumberOfDoors = i_NumberOfDoors;
 }