Пример #1
0
        static void Main(string[] args)
        {
            Zero zeroCar = new Zero()
            {
                MainColor        = "red",
                BatteryKWh       = 7.5,
                MaximumOccupancy = "two",
            };

            Tesla teslaCar = new Tesla()
            {
                MainColor        = "blue",
                BatteryKWh       = 8.7,
                MaximumOccupancy = "three",
            };

            Ram ramCar = new Ram()
            {
                MainColor        = "yellow",
                MaximumOccupancy = "four",
                FuelCapacity     = 4.3,
            };

            Cessna cessnaCar = new Cessna()
            {
                MainColor        = "violet",
                MaximumOccupancy = "twenty-three",
                FuelCapacity     = 10.7,
            };

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

            garage.Add(cessnaCar);
            garage.Add(ramCar);
            garage.Add(teslaCar);
            garage.Add(zeroCar);



            cessnaCar.Drive();
            ramCar.Drive();
            teslaCar.Drive();
            zeroCar.Drive();

            cessnaCar.Turn();
            ramCar.Turn();
            teslaCar.Turn();
            zeroCar.Turn();

            cessnaCar.Stop();
            ramCar.Stop();
            teslaCar.Stop();
            zeroCar.Stop();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Zero myMotorcycle = new Zero();

            myMotorcycle.MainColor        = "red";
            myMotorcycle.MaximumOccupancy = "1";
            myMotorcycle.BatteryKWh       = 5;

            Cessna myPlane = new Cessna();

            myPlane.FuelCapacity     = 105.5;
            myPlane.MainColor        = "white";
            myPlane.MaximumOccupancy = "14";

            Ram myTruck = new Ram();

            myTruck.FuelCapacity     = 15;
            myTruck.MaximumOccupancy = "5";
            myTruck.MainColor        = "green";

            Tesla myCar = new Tesla();

            myCar.BatteryKWh       = 18.5;
            myCar.MainColor        = "black";
            myCar.MaximumOccupancy = "2";

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

            garage.Add(myMotorcycle);
            garage.Add(myTruck);
            garage.Add(myCar);
            garage.Add(myPlane);

            myPlane.Drive();
            myCar.Drive();
            myMotorcycle.Drive();
            myTruck.Drive();

            myTruck.Turn("left");
            myCar.Turn("right");
            myMotorcycle.Turn("slightly left");
            myPlane.Turn("a bit right");

            myTruck.Stop();
            myCar.Stop();
            myPlane.Stop();
            myMotorcycle.Stop();



            Console.WriteLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Zero myMotorcycle = new Zero();

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

            Tesla modelThree = new Tesla();

            modelThree.MainColor        = "Black";
            modelThree.MaximumOccupancy = "5";
            modelThree.BatteryKWh       = 75;

            Cessna traffickingPlane = new Cessna();

            traffickingPlane.MainColor        = "White";
            traffickingPlane.MaximumOccupancy = "3";
            traffickingPlane.FuelCapacity     = 56;

            Ram muddinTruck = new Ram();

            muddinTruck.MainColor        = "Real-Tree Camo";
            muddinTruck.MaximumOccupancy = "12";
            muddinTruck.FuelCapacity     = 23;

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

            garage.Add(myMotorcycle);
            garage.Add(modelThree);
            garage.Add(traffickingPlane);
            garage.Add(muddinTruck);

            modelThree.Drive();
            traffickingPlane.Drive();
            myMotorcycle.Drive();
            muddinTruck.Drive();

            modelThree.Turn("right");
            traffickingPlane.Turn("left");
            myMotorcycle.Turn("right");
            muddinTruck.Turn("left");

            modelThree.Stop();
            traffickingPlane.Stop();
            myMotorcycle.Stop();
            muddinTruck.Stop();
        }
Пример #4
0
        static void Main(string[] args)
        {
            Zero   fxs       = new Zero();
            Tesla  modelS    = new Tesla();
            Cessna mx410     = new Cessna();
            Ram    proMaster = new Ram();

            fxs.MainColor        = "red";
            fxs.MaximumOccupancy = "1";
            fxs.Drive();
            fxs.Turn("left");
            fxs.Stop();

            modelS.MainColor        = "yellow";
            modelS.MaximumOccupancy = "5";
            modelS.Drive();
            modelS.Turn("right");
            modelS.Stop();

            mx410.MainColor        = "white";
            mx410.MaximumOccupancy = "8";
            mx410.Drive();
            mx410.Turn("left");
            mx410.Stop();

            proMaster.MainColor        = "black";
            proMaster.MaximumOccupancy = "12";
            proMaster.Drive();
            proMaster.Turn("right");
            proMaster.Stop();

            List <IElectric> electricVehicles = new List <IElectric>()
            {
                modelS, fxs
            };

            List <IGasoline> gasVehicles = new List <IGasoline>()
            {
                proMaster, mx410
            };

            GasStation      speedway    = new GasStation(16);
            ElectricStation supercharge = new ElectricStation(1);

            speedway.Refuel(gasVehicles);
            supercharge.Refuel(electricVehicles);
            Console.WriteLine();
        }
Пример #5
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();
        }