static void Main(string[] args) { var zero = new Zero(); var teslaX = new Tesla(); var tesla = new Tesla(); var cessna = new Cessna(); var ram = new Ram(); zero.MainColor = "White"; tesla.MaximumOccupancy = 5; tesla.MainColor = "Black"; tesla.MaximumOccupancy = 4; cessna.MainColor = "Red"; cessna.MaximumOccupancy = 20; ram.MainColor = "Blue"; ram.MaximumOccupancy = 6; zero.TestDrive("right"); tesla.TestDrive("left"); cessna.TestDrive("up in the air"); ram.TestDrive("back"); teslaX.TestDrive("left"); ram.FuelCapacity = 15; Console.WriteLine(ram); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; var myTesla = new Tesla(); myTesla.MainColor = "Midnight Silver"; myTesla.MaxOccupancy = 8; var myRam = new Ram(); myRam.MainColor = "Silver"; myRam.MaxOccupancy = 6; var myCessna = new Cessna(); myCessna.MainColor = "White"; myCessna.MaxOccupancy = 5; myBike.Drive(); myTesla.Drive(); myRam.Drive(); myCessna.Drive(); }
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($"{ev.CurrentChargePercentage()}"); } foreach (IElectricVehicle ev in electricVehicles) { // This should charge the vehicle to 100% ev.ChargeBattery(); } foreach (IElectricVehicle ev in electricVehicles) { Console.WriteLine($"{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($"{gv.CurrentTankPercentage()}"); } foreach (IGasVehicle gv in gasVehicles) { // This should completely refuel the gas tank gv.RefuelTank(); } foreach (IGasVehicle gv in gasVehicles) { Console.WriteLine($"{gv.CurrentTankPercentage()}"); } }
static void Main(string[] args) { var zero = new Zero(); var tesla = new Tesla(); var cessna = new Cessna(); var ram = new Ram(); zero.MainColor = "White"; tesla.MaximumOccupancy = 5; zero.Drive(); tesla.Drive(); cessna.Drive(); ram.Drive(); ram.FuelCapacity = 12; Console.WriteLine(ram); }
static void Main(string[] args) { var myBike = new Zero(); myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.Name = "Zero"; var myTesla = new Tesla(); myTesla.MainColor = "Space Gray"; myTesla.MaxOccupancy = 6; myTesla.Name = "Tesla"; var myCessna = new Cessna(); myCessna.MainColor = "Wine Berry Over Gold"; myCessna.MaxOccupancy = 4; myCessna.Name = "Cessna"; var myRam = new Ram(); myRam.MainColor = "Majestic Blue"; myRam.MaxOccupancy = 8; myRam.Name = "Ram"; myBike.Stop(); myBike.Turn(); myBike.Drive(); myTesla.Stop(); myTesla.Turn(); myTesla.Drive(); myCessna.Stop(); myCessna.Turn(); myCessna.Drive(); myRam.Stop(); myRam.Turn(); myRam.Drive(); Console.WriteLine(myTesla); double price = 15.00; Console.WriteLine(price.ToString("C")); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.Name = "Zero"; myBike.Drive(); myBike.Turn(); myBike.Stop(); Console.WriteLine("-----------------"); var myTesla = new Tesla(); myTesla.MainColor = "midnight silver"; myTesla.MaxOccupancy = 6; myTesla.Name = "Tesla"; myTesla.Drive(); myTesla.Turn(); myTesla.Stop(); Console.WriteLine("-----------------"); var myCessna = new Cessna(); myCessna.MainColor = "blue"; myCessna.MaxOccupancy = 4; myCessna.Name = "Cessna"; myCessna.Drive(); myCessna.Turn(); myCessna.Stop(); Console.WriteLine("-----------------"); var myRam = new Ram(); myRam.MainColor = "purple"; myRam.MaxOccupancy = 4; myRam.Name = "Ram"; myRam.Drive(); myRam.Turn(); myRam.Stop(); Console.WriteLine("-----------------"); }
static void Main(string[] args) { var myBike = new Zero(); myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; myBike.BatteryKWh = 10; myBike.Name = "Zero Bike"; var myRoboTruck = new Tesla(); myRoboTruck.MainColor = "Midnight Silver"; myRoboTruck.MaxOccupancy = 6; myRoboTruck.Name = "Tesla Robotruck"; var myPlane = new Cessna(); myPlane.MainColor = "White"; myPlane.MaxOccupancy = 4; myPlane.Name = "Cessna Plane"; var myWorkTruck = new Ram(); myWorkTruck.MainColor = "Dirt Brown"; myWorkTruck.Name = "Ram Truck"; myWorkTruck.Drive(); myBike.Drive(); myRoboTruck.Drive(); myPlane.Drive(); myWorkTruck.Turn(); myBike.Turn(); myRoboTruck.Turn(); myPlane.Turn(); myWorkTruck.Stop(); myBike.Stop(); myRoboTruck.Stop(); myPlane.Stop(); }
static void Main(string[] args) { var myBike = new Zero(); // I can still reference the inherited property myBike.MainColor = "Black"; myBike.MaxOccupancy = 2; var myTesla = new Tesla(); myTesla.MainColor = "Midnight Silver"; myTesla.MaxOccupancy = 6; var myRam = new Ram(); myRam.MainColor = "Green"; myRam.MaxOccupancy = 5; var myCessna = new Cessna(); myCessna.MainColor = "Silver"; myBike.Drive(); myBike.Turn("right"); myBike.Stop(); myTesla.Drive(); myTesla.Turn("left"); myTesla.Stop(); myCessna.Drive(); myCessna.Turn("right"); myCessna.Stop(); myRam.Drive(); myRam.Turn("left"); myRam.Stop(); // double price = 15.50; // Console.WriteLine (price.ToString ("C")); }