Beispiel #1
0
        static void Main(string[] args)
        {
            Cessna flyBoy = new Cessna();

            flyBoy.FuelCapacity     = 29.92;
            flyBoy.MainColor        = "Purple";
            flyBoy.MaximumOccupancy = 670;

            Ram notFordTough = new Ram();

            notFordTough.FuelCapacity     = 1.1;
            notFordTough.MainColor        = "Magenta";
            notFordTough.MaximumOccupancy = 0;

            Tesla electricBoy = new Tesla();

            electricBoy.BatteryKWh       = 32.23;
            electricBoy.MainColor        = "Turquoise";
            electricBoy.MaximumOccupancy = 69;

            Zero wheelieBoy = new Zero();

            wheelieBoy.BatteryKWh       = 100.32;
            wheelieBoy.MaximumOccupancy = 2;
            wheelieBoy.MainColor        = "Aquamarine";
            List <Vehicle> electircList = new List <Vehicle>();

            electircList.Add(electricBoy);
            electircList.Add(wheelieBoy);

            List <Vehicle> gasList = new List <Vehicle>();

            gasList.Add(notFordTough);
            gasList.Add(flyBoy);

            BatteryStation batteryStation = new BatteryStation();

            batteryStation.Capacity = 10;
            Console.WriteLine();
            batteryStation.Refuel(electircList);
            Console.WriteLine();

            GasStation gasStation = new GasStation();

            gasStation.Capacity = 15;
            gasStation.Refuel(gasList);

            // flyBoy.Drive();
            // flyBoy.Stop();
            // flyBoy.Turn("right");
            // Console.WriteLine("- - - - - - - - - - - - -");
            // notFordTough.Drive();
            // notFordTough.Turn("backwards");
            // notFordTough.Stop();
            // Console.WriteLine("- - - - - - - - - - - - -");
            // electricBoy.Drive();
            // electricBoy.Stop();
            // electricBoy.Turn("up");
            // Console.WriteLine("- - - - - - - - - - - - -");
            // wheelieBoy.Drive();
            // wheelieBoy.Turn("underground");
            // wheelieBoy.Stop();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Zero myMotorcycle = new Zero();

            myMotorcycle.MainColor        = "Red";
            myMotorcycle.MaximumOccupancy = "2";
            myMotorcycle.BatteryKWh       = 2.0;

            Tesla fancyCar = new Tesla();

            fancyCar.MainColor        = "Silver";
            fancyCar.MaximumOccupancy = "5";
            fancyCar.BatteryKWh       = 20.4;

            Cessna personalJet = new Cessna();

            personalJet.MainColor        = "White";
            personalJet.MaximumOccupancy = "15";
            personalJet.FuelCapacity     = 80.5;

            Ram superHugeTruck = new Ram();

            superHugeTruck.MainColor        = "Blue";
            superHugeTruck.MaximumOccupancy = "5";
            superHugeTruck.FuelCapacity     = 40.5;

            Prius myPrius = new Prius();

            myPrius.MainColor        = "Gray";
            myPrius.FuelCapacity     = 100000;
            myPrius.MaximumOccupancy = "5";

            List <IVehicle> garage = new List <IVehicle>();

            garage.Add(myMotorcycle);
            garage.Add(superHugeTruck);
            garage.Add(fancyCar);
            garage.Add(personalJet);

            List <IElectricPowered> electricVehicles = new List <IElectricPowered>()
            {
                fancyCar, myMotorcycle, myPrius
            };

            electricVehicles.ForEach(ev => ev.ChargeBattery());

            List <IGasPowered> gasVehicles = new List <IGasPowered>()
            {
                superHugeTruck, personalJet, myPrius
            };

            gasVehicles.ForEach(gv => gv.RefuelTank());

            personalJet.Drive();
            personalJet.Turn("right");
            personalJet.Stop();

            Console.WriteLine("\n");

            fancyCar.Drive();
            fancyCar.Turn("right");
            fancyCar.Stop();

            Console.WriteLine("\n");

            myMotorcycle.Drive();
            myMotorcycle.Turn("right");
            myMotorcycle.Stop();

            Console.WriteLine("\n");

            superHugeTruck.Drive();
            superHugeTruck.Turn("right");
            superHugeTruck.Stop();

            Console.WriteLine();
        }