static void Main(string[] args)
        {
            Zero fxs = new Zero();

            fxs.Name = "fxs";
            Tesla modelS = new Tesla();

            modelS.Name = "modelS";
            Zero fx = new Zero();

            fx.Name = "fx";

            List <IElectricPowered> electricVehicles = new List <IElectricPowered>();

            electricVehicles.Add(fxs);
            electricVehicles.Add(modelS);
            electricVehicles.Add(fx);

            Ram ram = new Ram();

            ram.Name = "Ram";
            Cessna mx410 = new Cessna();

            mx410.Name = "mx410";

            List <IGasPowered> gasVehicles = new List <IGasPowered>();

            gasVehicles.Add(ram);
            gasVehicles.Add(mx410);

            GasStation brentwoodGas = new GasStation();

            brentwoodGas.Capacity = 3;

            BatteryStation brentwoodBattery = new BatteryStation();

            brentwoodBattery.Capacity = 4;

            brentwoodBattery.Refuel(electricVehicles);
            brentwoodGas.Refuel(gasVehicles);
        }
示例#2
0
        static void Main(string[] args)
        {
            Zero fxs = new Zero()
            {
                MainColor        = "Midnight Blue",
                MaximumOccupancy = "4",
                BatteryKWh       = 25.50
            };
            Zero fxs2 = new Zero()
            {
                MainColor        = "Black",
                MaximumOccupancy = "4",
                BatteryKWh       = 25.50
            };
            Tesla modelS = new Tesla()
            {
                MainColor        = "Burgundy",
                MaximumOccupancy = "4",
                BatteryKWh       = 44.00
            };
            Cessna mx410 = new Cessna()
            {
                MainColor        = "White",
                MaximumOccupancy = "4",
                FuelCapacity     = 89.50
            };
            Ram ram1500 = new Ram()
            {
                MainColor        = "Silver",
                MaximumOccupancy = "4",
                FuelCapacity     = 20.00
            };

            List <IElectricVehicle> ElectricVehicles = new List <IElectricVehicle>();
            List <IGasVehicle>      GasVehicles      = new List <IGasVehicle>();

            ElectricVehicles.Add(fxs);
            ElectricVehicles.Add(fxs2);
            ElectricVehicles.Add(modelS);

            GasVehicles.Add(mx410);
            GasVehicles.Add(ram1500);

            fxs.Drive();
            fxs.Turn();
            fxs.Stop();
            fxs2.Drive();
            fxs2.Turn();
            fxs2.Stop();
            modelS.Drive();
            modelS.Turn();
            modelS.Stop();
            mx410.Drive();
            mx410.Turn();
            mx410.Stop();
            ram1500.Drive();
            ram1500.Turn();
            ram1500.Stop();

            BatteryStation batteryStation = new BatteryStation();

            batteryStation.Refuel(ElectricVehicles);

            GasStation gasStation = new GasStation();

            gasStation.Refuel(GasVehicles);
        }