Example #1
0
        static void Main(string[] args)
        {
            Zero myMotorcycle = new Zero();

            myMotorcycle.MainColor = "Red";

            Cessna myPlane = new Cessna();

            myPlane.MainColor = "White";

            Tesla myTesla = new Tesla();

            myTesla.MainColor = "Blue";

            Ram myTruck = new Ram();

            myTruck.MainColor = "Black";

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

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

            foreach (Vehicle myVehicle in garage)
            {
                Console.WriteLine($"The {myVehicle.MainColor} {myVehicle} vehicle goes");
                myVehicle.Drive();
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Zero  fxs    = new Zero();
            Zero  fx     = new Zero();
            Tesla modelS = new Tesla();

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

            Console.WriteLine("Electric Vehicles");
            foreach (IElectric ev in electricVehicles)
            {
                Console.WriteLine($"{ev.CurrentChargePercentage}");
            }

            foreach (IElectric ev in electricVehicles)
            {
                // This should charge the vehicle to 100%
                ev.ChargeBattery();
            }

            foreach (IElectric ev in electricVehicles)
            {
                Console.WriteLine($"{ev.CurrentChargePercentage}");
            }

            /***********************************************/

            Ram    ram       = new Ram();
            Cessna cessna150 = new Cessna();

            List <IGas> gasVehicles = new List <IGas>()
            {
                ram, cessna150
            };

            Console.WriteLine("Gas Vehicles");
            foreach (IGas gv in gasVehicles)
            {
                Console.WriteLine($"{gv.CurrentTankPercentage}");
            }

            foreach (IGas gv in gasVehicles)
            {
                // This should completely refuel the gas tank
                gv.Refueltank();
            }

            foreach (IGas gv in gasVehicles)
            {
                Console.WriteLine($"{gv.CurrentTankPercentage}");
            }
        }
Example #3
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();
        }
Example #4
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();
        }
Example #5
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();
        }
Example #6
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();
        }
Example #7
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();
        }
Example #8
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();
        }