static void Main(string[] args) { Zero fxs = new Zero(); Zero fx = new Zero(); Tesla modelS = new Tesla(); List <IElectricVehicle> electricVehicles = new List <IElectricVehicle>() { fx, fxs, modelS }; Console.WriteLine("=====Electric Vehicles====="); // Iterates through all electric vehicles // Show each vehicle's initial charge // Recharge the vehicle // Show the new charge foreach (IElectricVehicle ev in electricVehicles) { ev.DisplayCharge(); ev.ChargeBattery(); ev.DisplayCharge(); Console.WriteLine(); } /***********************************************/ Ram ram = new Ram(); Cessna cessna150 = new Cessna(); List <IGasVehicle> gasVehicles = new List <IGasVehicle>() { ram, cessna150 }; Console.WriteLine("=====Gas Vehicles====="); // Iterates through all gas vehicles // Show each vehicle's initial gas tank amount // Refuel the vehicle // Show the new gas tank foreach (IGasVehicle gv in gasVehicles) { gv.DisplayGasTank(); gv.RefuelTank(); gv.DisplayGasTank(); Console.WriteLine(); } }
static void Main(string[] args) { //Cessna Cessna newPlane = new Cessna(); newPlane.FuelCapacity = 200.50; newPlane.MainColor = "green"; newPlane.MaximumOccupancy = "4"; //methods newPlane.Drive(newPlane); newPlane.Turn("east"); newPlane.Stop("airport"); //Zero Zero newMoto = new Zero(); newMoto.BatteryKwh = 5000; newMoto.MainColor = "matte black"; newMoto.MaximumOccupancy = "6"; //methods newMoto.Drive(newMoto); newMoto.Turn("west"); newMoto.Stop("grocery store"); //Tesla Tesla modelS = new Tesla(); modelS.BatteryKWh = 10000; modelS.MainColor = "blue"; modelS.MaximumOccupancy = "20"; modelS.Drive(modelS); modelS.Turn("north"); modelS.Stop("aquarium"); //Ram Ram rebel = new Ram(); rebel.FuelCapacity = 20.10; rebel.MainColor = "black"; rebel.MaximumOccupancy = "100"; //methods rebel.Drive(rebel); rebel.Turn("south"); rebel.Stop("park"); }