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"); foreach (IElectricVehicle ev in electricVehicles) { Console.WriteLine($"Current Vehicle Charge: {ev.CurrentChargePercentage}"); } foreach (IElectricVehicle ev in electricVehicles) { // This should charge the vehicle to 100% ev.ChargeBattery(); Console.WriteLine("Vehicle Charged"); } foreach (IElectricVehicle ev in electricVehicles) { Console.WriteLine($"Currenet Vehicle Charge: {ev.CurrentChargePercentage}"); } /***********************************************/ Ram ram = new Ram(); Cessna cessna150 = new Cessna(); List <IGasVehicle> gasVehicles = new List <IGasVehicle>() { ram, cessna150 }; Console.WriteLine("Gas Vehicles"); foreach (IGasVehicle gv in gasVehicles) { Console.WriteLine($"Current fuel percentage: {gv.CurrentTankPercentage}"); } foreach (IGasVehicle gv in gasVehicles) { // This should completely refuel the gas tank gv.RefuelTank(); Console.WriteLine("Tank Refueled"); } foreach (IGasVehicle gv in gasVehicles) { Console.WriteLine($"Current fuel percentage: {gv.CurrentTankPercentage}"); } }
static void Main(string[] args) { //Making new classees Cessna cessna = new Cessna(); Ram ram = new Ram(); Tesla tesla = new Tesla(); Zero zero = new Zero(); cessna.MainColor = "Black"; ram.MainColor = "White"; tesla.MainColor = "Blue"; zero.MainColor = "Red"; cessna.Drive(); cessna.Turn("west"); cessna.Stop(); ram.Drive(); ram.Turn("east"); ram.Stop(); tesla.Drive(); tesla.Turn("right"); tesla.Stop(); zero.Drive(); zero.Turn("left"); zero.Stop(); }
static void Main(string[] args) { var myBike = new Zero(); myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; var myTesla = new Tesla(); myTesla.MainColor = "Midnight Silver"; myTesla.MaxOccupancy = 6; var myRam = new Ram(); myRam.MainColor = "Raging Red"; var myCessna = new Cessna(); myCessna.MainColor = "White"; myBike.Drive(); myBike.Turn("down for what"); myBike.Stop(); myTesla.Drive(); myTesla.Turn("left"); myTesla.Stop(); myRam.Drive(); myRam.Turn("right"); myRam.Stop(); myCessna.Drive(); myCessna.Turn("up"); myCessna.Stop(); }
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"); foreach (IElectricVehicle ev in electricVehicles) { Console.WriteLine($"The car is at {ev.CurrentChargePercentage}%"); } foreach (IElectricVehicle ev in electricVehicles) { // This should charge the vehicle to 100% ev.ChargeBattery(); } foreach (IElectricVehicle ev in electricVehicles) { Console.WriteLine($"Now the car is at {ev.CurrentChargePercentage}%"); } /***********************************************/ Ram ram = new Ram(); Cessna cessna150 = new Cessna(); List <IGasVehicle> gasVehicles = new List <IGasVehicle> () { ram, cessna150 }; Console.WriteLine("Gas Vehicles"); foreach (IGasVehicle gv in gasVehicles) { Console.WriteLine($"The gas vehicle has {gv.CurrentTankPercentage} of its tank left"); } foreach (IGasVehicle gv in gasVehicles) { // This should completely refuel the gas tank gv.RefuelTank(); } foreach (IGasVehicle gv in gasVehicles) { Console.WriteLine($"Now the vehicle is full at {gv.CurrentTankPercentage}%"); } }
static void Main(string[] args) { Zero fxs = new Zero("white"); Tesla modelS = new Tesla("red"); Cessna mx410 = new Cessna("blue"); Ram ram = new Ram("black"); fxs.Drive(); modelS.Drive(); mx410.Drive(); ram.Drive(); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaximumOccupancy = 2; myBike.BatteryKWh = 4.523; var myTesla = new Tesla(); myTesla.MainColor = "Midnight Silver"; myTesla.MaximumOccupancy = 6; myTesla.BatteryKWh = 3.221; var myCessna = new Cessna(); myCessna.MainColor = "Sky Blue"; myCessna.MaximumOccupancy = 12; myCessna.FuelCapacity = 52.5; var myRam = new Ram(); myRam.MainColor = "Red"; myRam.MaximumOccupancy = 5; myRam.FuelCapacity = 40.25; myBike.Drive(); myBike.Turn("right"); myBike.Stop(); Console.WriteLine(""); myTesla.Drive(); myTesla.Turn("left"); myTesla.Stop(); Console.WriteLine(""); myCessna.Drive(); myCessna.Turn("up"); myCessna.Stop(); Console.WriteLine(""); myRam.Drive(); myRam.Turn("right"); myRam.Stop(); Console.WriteLine(""); }
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); }
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); }