static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var car1 = new Car(); car1.Make = "Pontiac"; car1.Model = "G6"; car1.NumberOfPassengers = 5; car1.NumberOfWheels = 4; car1.Slogan = "Pontiac is Car"; car1.YearFounded = 1907; car1.NumberOfDoors = 4; car1.TrunkSize = 6; var truck1 = new Truck(); truck1.Make = "Ford"; truck1.Model = "F-150"; truck1.NumberOfPassengers = 3; truck1.NumberOfWheels = 4; truck1.Slogan = "Built Ford Proud"; truck1.YearFounded = 1903; truck1.HasSecondRow = false; truck1.BedSize = 66; var suv1 = new SUV(); suv1.Make = "Chevy"; suv1.Model = "Equinox"; suv1.NumberOfPassengers = 5; suv1.NumberOfWheels = 4; suv1.Slogan = "Find New Roads"; suv1.YearFounded = 1911; suv1.ThirdRow = false; suv1.CargoHoldSize = 30; var vehicle = new List <IVehicle>() { car1, truck1, suv1 }; var company = new List <ICompany>() { car1, truck1, suv1 }; var cars = new List <Car>(); cars.Add(car1); var trucks = new List <Truck>(); trucks.Add(truck1); var suvs = new List <SUV>(); suvs.Add(suv1); car1.CallSpecs(); truck1.TruckSpecs(); suv1.SuvSpecs(); }
static void Main(string[] args) { //DONE- TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE - Create 2 Interfaces called IVehicle & ICompany //DONE - Create 3 classes called Car , Truck , & SUV //DONE - In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //DONE - In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //DONE - In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //DONE - Now, create objects of your 3 classes and give their members values; Car car1 = new Car() { BodyType = "Sedean", CargoSize = 95.5, NumberOfWheels = 4, Mileage = 35123, EngineType = "Gas", IsDriveable = true, Model = "Taurus", Logo = "Oval", Name = "Ford" }; Car car2 = new Car() { BodyType = "Hatchback", CargoSize = 92.5, NumberOfWheels = 4, Mileage = 155653, EngineType = "Gas", IsDriveable = false, Model = "Rav4", Logo = "Oval", Name = "Toyota" }; Truck truck1 = new Truck() { BedLength = 96, TruckSize = "OneTon", NumberOfWheels = 6, Mileage = 155653, EngineType = "Diesel", IsDriveable = false, Model = "F-350", Logo = "Oval", Name = "Ford" }; //Creatively display and organize their values List <IVechicle> vechicles = new List <IVechicle>(); vechicles.Add(car1); vechicles.Add(car2); vechicles.Add(truck1); foreach (var vech in vechicles) { Console.WriteLine($"Engine Type {vech.EngineType} -- Model {vech.Model}"); Console.WriteLine(); } }
static void Main(string[] args) { var car = new Car(); car.AppleCarPlay = true; car.TrunkSize = 16; car.Logo = true; car.MPG = 19; car.NumberofDoors = 4; car.NumberofSeats = 5; car.VehicleName = "2020 Chrysler 300"; car.WarrantyLength = "3 months"; var suv = new SUV(); suv.SeatRows = 2; suv.NumberofCupHolders = 4; suv.Logo = true; suv.MPG = 24; suv.NumberofDoors = 4; suv.NumberofSeats = 5; suv.VehicleName = "2016 Mazda Cx-5"; suv.WarrantyLength = "3 months"; var truck = new Truck(); truck.NumberofDoors = 2; truck.TruckType = "Pick-up"; truck.HasBed = true; truck.Logo = true; truck.MPG = 15; truck.NumberofDoors = 2; truck.NumberofSeats = 5; truck.VehicleName = "2017 Ram 1500"; //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONECreate 2 Interfaces called IVehicle & ICompany //DONE Create 3 classes called Car , Truck , & SUV //In your IVehicle /* DONECreate 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*DONE Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*DONECreate 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * DONEThen, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //DONENow, create objects of your 3 classes and give their members values; //DONECreatively display and organize their values }
static void Main(string[] args) { #region TODOs //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV // In each of your car, truck, and suv classes // TODO - Create 2 members that are specific to each class // Example: truck has a bed size while car has a trunk while suv has a cargo hold size // TODO - Set each class to inherit from both IVehicle and ICompany and implement their members. //TODO - create objects of your 3 classes and give their members values; //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values #endregion Truck myTruck = new Truck(); myTruck.HasTrailer = true; myTruck.HasHeadLights = true; myTruck.IsCommercial = false; myTruck.HasHeadLights = true; myTruck.NumberOfWheels = 4; myTruck.GasMileage = 15; myTruck.Color = "blue"; myTruck.Logo = "Ford Logo"; myTruck.Slogan = "Built Ford Tough"; // Object initializer syntax Car myCar = new Car() { HasOnly2Doors = true, HasTrunk = true, IsConvertible = true, NumberOfWheels = 4, HasHeadLights = true, HasTailLights = true, GasMileage = 25, Color = "silver", Logo = "BMW Logo", Slogan = "The Ultimate Driving Machine" }; // Parameterized Constructor SUV mySUV = new SUV(true, true, 4, true, true, 15, "black", "Cadillac Logo", "Standard of the World"); //Creatively display and organize their values var vehicles = new List <IVehicle>(); vehicles.Add(myTruck); vehicles.Add(mySUV); vehicles.Add(myCar); foreach (var vehicle in vehicles) { Console.WriteLine($"{vehicle.GetType().GUID}: {vehicle.GetType().Name}"); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values Car myCar = new Car() { Color = "Red", EmployeeSize = 218674, HasTrunk = true, Hatchback = true, Make = "Honda", Model = "FIT", PubliclyTraded = true, Year = 2008 }; Truck myTruck = new Truck() { BedLengthFt = 8, Color = "Grey", EmployeeSize = 370870, Make = "Toyota", Model = "Tocoma", PubliclyTraded = true, TowingCapacityLb = 3500, Year = 2020 }; SUV wifeSUV = new SUV() { Color = "White", EmployeeSize = 218674, Make = "Honda", Model = "CRV", PubliclyTraded = true, ThirdRow = false, TrunkVolume = 35.7, Year = 2010 }; myCar.DisplayGeneralInformation(); myCar.DisplaySpecificInformation(); myCar.DisplayCompanyInformation(); myTruck.DisplayGeneralInformation(); myTruck.DisplaySpecificInformation(); myTruck.DisplayCompanyInformation(); wifeSUV.DisplayGeneralInformation(); wifeSUV.DisplaySpecificInformation(); wifeSUV.DisplayCompanyInformation(); }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; Truck myTruck = new Truck(); myTruck.BedSize = 6; myTruck.ExteriorPaintColor = "red"; myTruck.InteriorPaintColor = "black"; myTruck.Logo = "Chevy"; myTruck.NumberOfTires = 4; myTruck.NumberofWheels = 4; myTruck.PayLoadSize = 10; myTruck.Slogan = "Built Tough"; Car myCar = new Car(); myCar.InteriorPaintColor = "white"; myCar.ExteriorPaintColor = "blue"; myCar.NumberOfTires = 4; myCar.NumberofWheels = 4; myCar.Slogan = "Drive Comfortably"; myCar.TrunkSize = "six"; SUV mySUV = new SUV(); mySUV.HasCargoHold = true; mySUV.ExteriorPaintColor = "silver"; mySUV.HasTVScreen = true; mySUV.InteriorPaintColor = "taupe"; mySUV.NumberOfTires = 4; mySUV.NumberofWheels = 4; mySUV.Slogan = "Come Drive Me"; //Creatively display and organize their values Console.WriteLine($"{myTruck.BedSize},{myTruck.ExteriorPaintColor} "); }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany -DONE //Create 3 classes called Car , Truck , & SUV -DONE //In your IVehicle -DONE /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany -DONE /*Create 2 members that are specific to each every company -DONE * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes - DONE /*Create 2 members that are specific to each class - DONE * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; Car focus = new Car() { Logo = "blue oval", Make = "ford", Model = "focus", NumberOfTires = 4, Reputation = "Good", Year = 2000, HasTrunk = true, HowManyDoors = 4 }; Car pontiac = new Car() { Logo = "paper airplane", Make = "pontiac", Model = "grand am", NumberOfTires = 4, Reputation = "Good", Year = 2004, HasTrunk = true, HowManyDoors = 4 }; SUV rav = new SUV() { Logo = "Weird circle", Make = "Toyota", Model = "Rav4", NumberOfTires = 4, Reputation = "Bad", Year = 2016, HasCableMount = false, HowManyWheelDrive = 2 }; SUV forerunner = new SUV() { Logo = "Ram's Head", Make = "Dodge", Model = "Ram", NumberOfTires = 4, Reputation = "Good", Year = 2018, HasCableMount = true, HowManyWheelDrive = 4 }; Truck ridgeline = new Truck() { Logo = "Double Hockeysticks", Make = "Honda", Model = "Ridgeline", NumberOfTires = 4, Reputation = "Good", Year = 1998, CanSleep = false, RequireCert = false }; Truck semiTrailer = new Truck() { Logo = "Bison Horns", Make = "Wabash", Model = "Long-Haul", NumberOfTires = 16, Reputation = "Bad", Year = 1974, CanSleep = true, RequireCert = true }; //Creatively display and organize their values List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(focus); vehicles.Add(pontiac); vehicles.Add(rav); vehicles.Add(forerunner); vehicles.Add(ridgeline); vehicles.Add(semiTrailer); foreach (IVehicle vehicle in vehicles) { Console.WriteLine($"Year {vehicle.Year} Make {vehicle.Make} Model {vehicle.Model}"); Console.WriteLine("---------------"); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany-DONE //Create 3 classes called Car , Truck , & SUV-DONE //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common.-DONE * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type.-DONE * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class-DONE * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members.-DONE * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var vehicles = new List <IVehicle>(); var sedan1 = new Car(); sedan1.Name = "Dodge Charger"; sedan1.CorpName = "Daimler Chrysler"; sedan1.Slogan = "Best 4 Door Class"; sedan1.HowManyWheels = 4; sedan1.HasLeatherSeats = true; sedan1.HasSteeringWheel = true; sedan1.HasStereo = true; vehicles.Add(sedan1); var pickup1 = new Truck(); pickup1.Name = "Ford F-150"; pickup1.CorpName = "Ford Motor Company"; pickup1.Slogan = "Best Rated Truck"; pickup1.HowManyWheels = 4; pickup1.HasSteeringWheel = true; pickup1.HasStereo = false; pickup1.HasTruckBed = true; vehicles.Add(pickup1); var suv1 = new SUV(); suv1.Name = "Jeep Wrangler"; suv1.HasSteeringWheel = true; suv1.HowManyWheels = 4; suv1.FourWheelDrive = true; suv1.HasStereo = true; vehicles.Add(suv1); foreach (var x in vehicles) { Console.WriteLine($"Vehicle {x.Name} has {x.HowManyWheels} wheels. It is {x.HasStereo} it has a stereo."); Console.WriteLine(); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE - Create 2 Interfaces called IVehicle & ICompany //DONE - Create 3 classes called Car , Truck , & SUV //DONE - In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //DONE - In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*DONE - Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * DONE - Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ // DONE - Now, create objects of your 3 classes and give their members values; Car myFirstCar = new Car { CompanyLogo = "Toyota", CompanyName = "Toyota", HasFogLights = false, HasHorn = true, HasTrunk = true, HeightFromGround = 19, NumberOfDoors = 4, NumberOfWheels = 4 }; Truck myFirstTruck = new Truck { NumberOfWheels = 4, BedSize = 6, NumberOfDoors = 2, HasHorn = true, CompanyLogo = "honda", CompanyName = "honda", HasFogLights = true, IsLifted = true }; SUV myFirstSUV = new SUV { HasFogLights = false, CompanyName = "Audi", CompanyLogo = "audi symbol", HasHorn = true, NumberOfDoors = 4, HasTrunkCover = true, NumberOfWheels = 4, TrunkHeight = 35 }; //Creatively display and organize their values List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(myFirstSUV); vehicles.Add(myFirstTruck); vehicles.Add(myFirstCar); foreach (IVehicle vehicle in vehicles) { vehicle.Drive(); Console.WriteLine($"Number of Doors: {vehicle.NumberOfDoors}, Number of Wheels: {vehicle.NumberOfWheels}, Has Horn: {vehicle.HasHorn}, Has Fog Lights: {vehicle.HasFogLights}"); Console.WriteLine(); } }
static void Main(string[] args) { //Create 2 Interfaces called IVehicle & ICompany --DONE //Create 3 classes called Car , Truck , & SUV --DONE //In your IVehicle --DONE /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany --DONE /*Create 2 members that are specific to each every company * regardless of vehicle type. */ //In each of your car, truck, and suv classes --DONE /*Create 2 members that are specific to each class * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * Create objects of your 3 classes and give their members values * Creatively display and organize their values */ var vehicle = new List <IVehicle>(); // Objects for Car var camry = new Car(); camry.VehicleName = "Toyota Camry"; camry.CompanyName = "Toyota"; camry.Slogan = "Let's us go places"; camry.NumberOfSeats = 5; camry.NumberOfDoors = 4; camry.HasSpareTire = true; camry.Stereo = false; camry.NumberOfWheels = 4; camry.IsAutomatic = true; vehicle.Add(camry); // Objects for Truck var tanker = new Truck(); tanker.VehicleName = "Bulkheads"; tanker.CompanyName = "Safe Rack"; tanker.Slogan = "Orange. Safety has color"; tanker.HasTruckBed = true; tanker.HasFourWheelsDrive = true; tanker.HasSpareTire = true; tanker.Stereo = true; tanker.NumberOfWheels = 20; tanker.IsAutomatic = true; vehicle.Add(tanker); // Objects for SUV var suv = new Suv(); suv.VehicleName = "Jeep Wrangler Unlimited"; suv.CompanyName = "Jeep"; suv.Slogan = "Go Anywhere. Do Anything."; suv.EngineType = "Electrical Engine"; suv.Mileage = 666; suv.HasSpareTire = true; suv.Stereo = true; suv.IsAutomatic = true; suv.NumberOfWheels = 4; vehicle.Add(suv); foreach (var veh in vehicle) { Console.WriteLine(); Console.WriteLine($"{veh.VehicleName} has {veh.NumberOfWheels} wheels. Is automatic? {veh.IsAutomatic}. Has spare tire? {veh.HasSpareTire}. What about stereo? {veh.Stereo}. "); Console.WriteLine("---------------------------------------------------------------------------------------------------------------"); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var car = new Car(); car.Reverse(); car.Park(); car.TurnOn(); Console.WriteLine(); var Truck = new Truck(); Truck.Reverse(); Truck.Park(); Truck.TurnOn(); Console.WriteLine(); var SUV = new SUV(); SUV.Reverse(); SUV.Park(); SUV.TurnOn(); Console.WriteLine(); Console.WriteLine($"it is pretty {car.IsSmall} not really meant for moving big items.It does come with {car.doors} doors,and {car.wheels} wheels.It is {car.ItDrives} that it drives and {car.work} it does work."); Console.WriteLine($"the truck is big : {Truck.IsBig}"); var newList = new List <ICompany>(); newList.Add(car); newList.Add(Truck); newList.Add(SUV); foreach (var item in newList) { Console.WriteLine($"{item.HasWorkers} they also have workers on site and remotely, and their logo is {item.Logo}"); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var platinum = new Truck() { Make = "Ford", Model = "Platinum", NumberOfSeats = 4, AutoTrans = true, Color = "silver", NumberOfWheels = 4, BedSize = 5, Domestic = true, Has4X4 = true, Logo = "FORD" }; var M3 = new Car() { Make = "BMW", Model = "M3", NumberOfSeats = 5, AutoTrans = false, Color = "green", NumberOfWheels = 4, HasNavigation = true, Domestic = false, Logo = "BMW", Trunksize = "Small" }; var tahoe = new SUV() { Make = "Chevy", Model = "Tahoe", NumberOfSeats = 6, AutoTrans = true, Color = "black", NumberOfWheels = 4, Domestic = true, Logo = "Chevy", CargoLimit = 500, HasDVD = true }; var auto = new List <IVehicle>(); auto.Add(platinum); auto.Add(M3); auto.Add(tahoe); foreach (var veh in auto) { Console.WriteLine($"Make: {veh.Make}, Model: {veh.Model}, has an Auto Transmission {veh.AutoTrans}, Is {veh.Color}, has {veh.NumberOfWheels} wheels, and has {veh.NumberOfSeats} seats"); Console.WriteLine(); } var comp = new List <ICompany>(); comp.Add(platinum); comp.Add(M3); comp.Add(tahoe); foreach (var item in comp) { Console.WriteLine($"Has the {item.Logo} Logo , Is a Domestic made vehicle {item.Domestic}."); Console.WriteLine(); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values //SUVs var firstSuv = new SUV(); firstSuv.CoName = "Honda"; firstSuv.Model = "Pilot"; firstSuv.Year = 2011; firstSuv.Logo = "an 'H' with a border"; firstSuv.ThirdRowSeating = false; firstSuv.CargoHoldSize = 18; firstSuv.WheelCount = 4; firstSuv.OffRoad = true; var secondSuv = new SUV(); secondSuv.CoName = "Toyota"; secondSuv.Model = "Highlander"; secondSuv.Year = 2009; secondSuv.Logo = "'the toyota eclipse'"; secondSuv.ThirdRowSeating = true; secondSuv.CargoHoldSize = 15; secondSuv.WheelCount = 4; secondSuv.OffRoad = true; //Trucks var firstTruck = new Truck(); firstTruck.CoName = "Toyota"; firstTruck.Model = "4 Runner"; firstTruck.Year = 1985; firstTruck.Logo = "'the toyota eclipse'"; firstTruck.TruckBedSize = 15; firstTruck.HasTrailerHitch = true; firstTruck.WheelCount = 4; firstTruck.OffRoad = true; var secondTruck = new Truck(); secondTruck.CoName = "Ford"; secondTruck.Model = "F150"; secondTruck.Year = 2015; secondTruck.Logo = "an oval with 'Ford' written in the center"; secondTruck.TruckBedSize = 20; secondTruck.HasTrailerHitch = true; secondTruck.WheelCount = 4; secondTruck.OffRoad = true; //Cars var firstCar = new Car(); firstCar.CoName = "Audi"; firstCar.Model = "A3"; firstCar.Year = 2020; firstCar.Logo = "4 rings"; firstCar.TrunkSize = 10; firstCar.IsConvertable = true; firstCar.WheelCount = 4; firstCar.OffRoad = false; var secondCar = new Car(); secondCar.CoName = "Mercedes Benz"; secondCar.Model = "A-Class"; secondCar.Year = 2021; secondCar.Logo = "a tri-point"; secondCar.TrunkSize = 11; secondCar.IsConvertable = false; secondCar.WheelCount = 4; secondCar.OffRoad = false; var vehicles = new List <IVehicle>(); vehicles.Add(firstSuv); vehicles.Add(secondSuv); vehicles.Add(firstTruck); vehicles.Add(secondTruck); vehicles.Add(firstCar); vehicles.Add(secondCar); var suvs = new List <SUV>(); var trucks = new List <Truck>(); var cars = new List <Car>(); suvs.Add(firstSuv); suvs.Add(secondSuv); trucks.Add(firstTruck); trucks.Add(secondTruck); cars.Add(firstCar); cars.Add(secondCar); foreach (var vehicle in vehicles) { Console.WriteLine($"This vehicle is called a '{vehicle.CoName} {vehicle.Model}' and it was made in the year {vehicle.Year}. This vehicle has {vehicle.WheelCount} wheels.\n " + $"It is {vehicle.OffRoad} that this vehilce can go off-road."); } foreach (var suv in suvs) { Console.WriteLine($"The {suv.Model} has {suv.CargoHoldSize} cubic square feet in the cargo area. It is {suv.ThirdRowSeating} that it has third row seating."); } foreach (var truck in trucks) { Console.WriteLine($"The {truck.Model} has {truck.TruckBedSize} cubic square feet in the truck bed. It is {truck.HasTrailerHitch} that it has a trailer hitch."); } foreach (var car in cars) { Console.WriteLine($"The {car.Model} has {car.TrunkSize} cubic square feet in the trunk. It is {car.IsConvertable} that it is a convertable."); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces // -- DONE -- Create 2 Interfaces called IVehicle & ICompany // -- DONE -- Create 3 classes called Car , Truck , & SUV // -- DONE -- In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ // -- DONE -- In ICompany /* -- DONE -- Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /* -- DONE -- Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var GT500 = new Car() { TrunkSpace = 13.5, HasGoodMileage = false, Engine = 5.2, Make = "Shelby", Model = "GT500 Mustang", Year = 2020, Logo = "Cobra", Slogan = "None" }; var shelby = new Truck() { BedSize = 5.5, HasLeafSprings = true, Engine = 5.0, Make = "Shelby", Model = "F-150", Year = 2020, Logo = "Cobra", Slogan = "None" }; var trackhawk = new SUV() { HasHatchback = true, HasThirdRowSeating = false, Engine = 6.2, Make = "Jeep", Model = "Grand Cherokee TrackHawk", Year = 2020, Logo = "Jeep", Slogan = "Go Anywhere, Do Anything" }; var cars = new List <IVehicle>() { GT500, shelby, trackhawk }; foreach (var car in cars) { Console.WriteLine($"Year: {car.Year}"); Console.WriteLine($"Make: {car.Make}"); Console.WriteLine($"Model: {car.Model}"); Console.WriteLine($"Supercharged {car.Engine}l engine"); if (car == shelby) { Console.WriteLine($"Bed Size: {shelby.BedSize}'."); Console.WriteLine($"Leaf Springs: {shelby.HasLeafSprings}"); Console.WriteLine($"Logo: {shelby.Logo}"); Console.WriteLine($"Slogan: {shelby.Slogan}"); } if (car == GT500) { Console.WriteLine($"Trunk Space: {GT500.TrunkSpace} cubic feet."); Console.WriteLine($"Good on gas: {GT500.HasGoodMileage}"); Console.WriteLine($"Logo: {GT500.Logo}"); Console.WriteLine($"Slogan: {GT500.Slogan}"); } if (car == trackhawk) { Console.WriteLine($"Hatchback Available: {trackhawk.HasHatchback}"); Console.WriteLine($"Third Row Seating Available: {trackhawk.HasThirdRowSeating}"); Console.WriteLine($"Logo: {trackhawk.Logo}"); Console.WriteLine($"Slogan: {trackhawk.Slogan}"); } Console.WriteLine("----------------------"); } }
static void Main(string[] args) { var car = new Car(); var truck = new Truck(); var suv = new SUV(); var vehicles = new List <IVehicle>() { car, truck, suv }; var company = new List <ICompany>() { car, truck, suv }; foreach (var vehicle in vehicles) { Console.WriteLine($"------------------"); //Console.WriteLine($"Make: {vehicle.Make}, Model: {vehicle.Model}, Year: {vehicle.Year}, and Type of Gas: {vehicle.TypeOfGas}"); if (vehicle.Make == "Honda") { Console.WriteLine($"Welcome to the {car.CompanyName} where the motto here is '{car.CompanySlogan}!' Lets see what we have:"); Console.WriteLine($"Make: {vehicle.Make}, Model: {vehicle.Model}, Year: {vehicle.Year}, and Type of Gas: {vehicle.TypeOfGas}"); Console.WriteLine($"Vehicle can hold {car.HowManyPassagers} and All Terrian: {car.IsItAllTerrian}"); } else if (vehicle.Make == "Ford") { Console.WriteLine($"Welcome to the {truck.CompanyName} where the motto here is '{truck.CompanySlogan}!' Lets see what we have:"); Console.WriteLine($"Make: {vehicle.Make}, Model: {vehicle.Model}, Year: {vehicle.Year}, and Type of Gas: {vehicle.TypeOfGas}"); Console.WriteLine($"Vehicle can hold {truck.HowManyPassagers} and All Terrian: {truck.IsItAllTerrian}"); } else { Console.WriteLine($"Welcome to the {suv.CompanyName} where the motto here is '{suv.CompanySlogan}!' Lets see what we have:"); Console.WriteLine($"Make: {vehicle.Make}, Model: {vehicle.Model}, Year: {vehicle.Year}, and Type of Gas: {vehicle.TypeOfGas}"); Console.WriteLine($"Vehicle can hold {suv.HowManyPassagers} and All Terrian: {suv.IsItAllTerrian}"); } } //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values }
static void Main(string[] args) { Car Neon = new Car { Year = "2003", Make = "dodge", Model = "Neon", EngineSize = "5HP Briggs", Coupe = false, Sedan = true, Decals = "Company Name", Equipment = "NA", }; Truck F700 = new Truck { Year = "1999", Make = "Ford", Model = "F700", EngineSize = "460CI", CrewCab = true, StandardCab = false, Decals = "company Information", Equipment = "Retrieval Winch", }; SUV Excursion = new SUV { Year = "2020", Make = "Ford", Model = "Excursion", EngineSize = "7.77 litre", RoofRack = true, ThirdRowSeat = true, Decals = "PRISONER TRANSPORT", Equipment = "Riot Gear", }; List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(Neon); vehicles.Add(F700); vehicles.Add(Excursion); foreach (IVehicle vehicle in vehicles) { Console.WriteLine($"Year: {vehicle.Year}"); Console.WriteLine($"Make: {vehicle.Make}"); Console.WriteLine($"Model: {vehicle.Model}"); Console.WriteLine($"Engin Size: {vehicle.EngineSize}"); vehicle.Drive(); Console.WriteLine(); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } List <ICompany> vehicle2 = new List <ICompany>(); vehicle2.Add(Neon); vehicle2.Add(F700); vehicle2.Add(Excursion); foreach (ICompany company in vehicle2) { Console.WriteLine($"Decals: {company.Decals}"); Console.WriteLine($"Equipment: {company.Equipment}"); Console.WriteLine($"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE Create 2 Interfaces called IVehicle & ICompany //DONE Create 3 classes called Car , Truck , & SUV //In your IVehicle /* DONE Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*DONE Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*DONE Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; Car myCar = new Car() { TrunkSize = 15, HasHatchback = false, NumOfWheels = 4, FuelType = "gas", NumOfDoors = 4, TransmissionType = "manual", Logo = "Toyota", Reputation = "reliability" }; Truck myTruck = new Truck() { BedSize = 93, HasCrewCab = false, NumOfWheels = 4, FuelType = "diesel", NumOfDoors = 2, TransmissionType = "automatic", Logo = "Ford", Reputation = "unreliable" }; SUV mySUV = new SUV() { CargoSpaceSize = 30, HasThirdRow = true, NumOfWheels = 4, FuelType = "gas", NumOfDoors = 4, TransmissionType = "automatic", Logo = "Subaru", Reputation = "green" }; //Creatively display and organize their values DisplayCar(myCar); PauseConsole(); DisplayTruck(myTruck); PauseConsole(); DisplaySUV(mySUV); PauseConsole(); Console.WriteLine("See ya later!"); }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany - DONE //In your IVehicle - DONE /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany - DONE /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //Create 3 classes called Car , Truck , & SUV - DONE //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class - DONE * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; - DONE //Creatively display and organize their values // Car #1 var camry = new Car(); camry.CompanyName = "Toyota"; camry.Model = "Camry"; camry.HasCDPlayer = true; camry.Motto = "Going places"; camry.SeatCount = 4; // Car #2 var mini = new Car(); mini.CompanyName = "Cooper"; mini.Model = "Mini"; mini.HasCDPlayer = true; mini.Motto = "Tiny BMW"; mini.SeatCount = 2; mini.EngineSize = 1.8; // Truck #1 var f150 = new Truck(); f150.CompanyName = "Ford"; f150.HasFourWheelDrive = false; f150.Model = "F150"; f150.Motto = "Ford Tough"; f150.EngineSize = 4.6; f150.BedSize = 22; // Truck #2 var silverado = new Truck(); silverado.CompanyName = "Chevrolet"; silverado.HasFourWheelDrive = true; silverado.Model = "Silverado"; silverado.Motto = "That's my Chevy"; silverado.EngineSize = 5.2; silverado.BedSize = 26; // SUV #1 var outback = new SUV(); outback.CompanyName = "Subaru"; outback.Model = "Outback"; outback.HasFourWheelDrive = true; outback.Motto = "It's a Subaru!"; outback.EngineSize = 2.0; outback.CargoSize = 28; // SUV #2 var rav4 = new SUV(); rav4.CompanyName = "Toyota"; rav4.Model = "RAV4"; rav4.Motto = "Going Places"; rav4.HasFourWheelDrive = true; rav4.EngineSize = 2.5; rav4.CargoSize = 24; var allVehicles = new List <IVehicle>() { camry, mini, f150, silverado, outback, rav4 }; foreach (var v in allVehicles) { Console.WriteLine($"{v.Model}: "); v.Drive(); v.ChangeGears(true); v.Reverse(); v.ChangeGears(true); v.Park(); Console.WriteLine(); } var cars = new List <Car>() { camry, mini }; foreach (var c in cars) { Console.WriteLine($"{c.CompanyName} {c.Model} with {c.SeatCount} seats"); Console.WriteLine($"and an engine size of {c.EngineSize}"); Console.WriteLine($"{c.Motto}"); Console.WriteLine(); } var trucks = new List <Truck>() { f150, silverado }; foreach (var t in trucks) { Console.WriteLine($"{t.CompanyName} {t.Model} with {t.SeatCount} seats"); Console.WriteLine($"and an engine size of {t.EngineSize}"); Console.WriteLine($"{t.Motto}"); Console.WriteLine(); } var suvs = new List <SUV>() { outback, rav4 }; foreach (var s in suvs) { Console.WriteLine($"{s.CompanyName} {s.Model} with {s.SeatCount} seats"); Console.WriteLine($"and a cargo size of {s.CargoSize}"); Console.WriteLine($"{s.Motto}"); Console.WriteLine(); } }
public static void DisplayTruck(Truck truck) { Console.WriteLine($"{truck.BedSize}, {truck.HasCrewCab}, {truck.NumOfWheels}, {truck.FuelType}, {truck.NumOfDoors}," + $" {truck.TransmissionType}, {truck.Logo}, {truck.Reputation}"); }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE - Create 2 Interfaces called IVehicle & ICompany //DONE - In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //DONE //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //Create 3 classes called Car , Truck , & SUV //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var car = new Car(); var truck = new Truck(); //List<IVehicle> vehicles = new List<IVehicle>(); //vehicles.Add(); //vehicles.Add(); var vehicles = new List <IVehicle>() { car, truck }; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); } }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //In each of your car, truck, and suv classes /*Create 2 members that are specific to each class * Example: truck has a bed size while car has a trunk while suv has a cargo hold size * * Then, Set each class to inherit from both IVehicle and ICompany and implement their members. * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values Car myCar = new Car(); { myCar.HasFourWheels = true; myCar.HasFourDoors = true; myCar.HasHeadLights = true; myCar.HasRearCamera = true; myCar.Make = "Cadillac"; myCar.Model = "SRX"; myCar.TrunkSpace = 30; myCar.GasMileage = 21; } Truck myTruck = new Truck(); { myTruck.HasFourWheels = true; myTruck.HasFourDoors = true; myTruck.HasHeadLights = true; myTruck.HasRearCamera = true; myTruck.Make = "Ford"; myTruck.Model = "F150"; myTruck.BedSize = 96; myTruck.GasType = "diesel"; } SUV mySUV = new SUV(); { mySUV.HasFourWheels = true; mySUV.HasFourDoors = true; mySUV.HasHeadLights = true; mySUV.HasRearCamera = true; mySUV.Make = "GMC"; mySUV.Model = "Yukon"; mySUV.CargoHoldSize = 95; mySUV.AmountOfSeats = 7; } Console.WriteLine($"does my car have: four wheels? {myCar.HasFourDoors}. Four doors? {myCar.HasFourDoors}." + $"Headlights? {myCar.HasHeadLights}. What about a backup camera? {myCar.HasRearCamera}. It is a {myCar.Make} " + $"{myCar.Model}, and it has about {myCar.TrunkSpace}ft trunk space, and {myCar.GasMileage}mi/g of gas mileage."); Console.WriteLine(""); Console.WriteLine($"does my truck have: four wheels? {myTruck.HasFourDoors}. Four doors? {myTruck.HasFourDoors}." + $"Headlights? {myTruck.HasHeadLights}. What about a backup camera? {myTruck.HasRearCamera}. It is a {myTruck.Make} " + $"{myTruck.Model}, and it has about {myTruck.BedSize} of bed space, and takes {myTruck.GasType} gas."); Console.WriteLine(""); Console.WriteLine($"does my SUV have: four wheels? {mySUV.HasFourDoors}. Four doors? {mySUV.HasFourDoors}." + $"Headlights? {mySUV.HasHeadLights}. What about a backup camera? {mySUV.HasRearCamera}. It is a {mySUV.Make} " + $"{mySUV.Model}, and it has about {mySUV.CargoHoldSize} cargo space, and {mySUV.AmountOfSeats} seats."); }