static void Main(string[] args) { var myVehicles = new List <IVehicle>(); var tacoma = new Truck() { CompanyName = "Toyota", HeadQuarterLocation = "Japan", Model = "Tacoma", IsUsedCar = true, Color = "Black", NumberOfMiles = 100000, TruckBedSize = 6, MaxTowLbs = 7000, HasChangedGears = false }; var subaru = new SUV() { CompanyName = "Subaru", HeadQuarterLocation = "Japan", Model = "Outback", IsUsedCar = false, Color = "blue", NumberOfMiles = 0, HasHatchBack = true, RowsOfSeats = 2, HasChangedGears = false }; var civic = new Car() { CompanyName = "Honda", HeadQuarterLocation = "Japan", Model = "Civic", IsUsedCar = true, Color = "Silver", NumberOfMiles = 150000, HasTrunk = true, IsLuxury = false, HasChangedGears = false }; myVehicles.Add(tacoma); myVehicles.Add(subaru); myVehicles.Add(civic); foreach (var vehicle in myVehicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); } }
static void Main(string[] args) { //hasTrunk,numberOfSeats,color,numberOfDoors,model,year,name,logo Car honda = new Car(true, "5", "blue", 4, "Civic", 2018, "Blue Bullet", "Honda"); //hasTruckBed,truckBedSize,color,numberOfDoors,model,year,name,logo Truck gmc = new Truck(true, "Large", "Tan", 2, "Sierra", 2016, "Junker", "GMC"); //hasHatchBack,numberOfSeats,color,numberOfDoors,model,year,name,logo SUV jeep = new SUV(false, "5", "silver", 5, "Grand Cherokee", 2010, "Hi ho Silver!", "JEEP"); Console.WriteLine($"Hello! We have three cars! We have a {honda.GetType().Name}, {gmc.GetType().Name}, " + $"and {jeep.GetType().Name}. \nThe {honda.GetType().Name} is a {honda.Year}, {honda.Logo} {honda.Model}" + $"\nWe call it the {honda.Name}. Does it have a trunk? That is {honda.HasTrunk}. \nIt has {honda.NumberOfSeats} seats, " + $"{honda.NumberOfDoors} doors, and it is {honda.Color}.\n \nThe {gmc.GetType().Name} is a {gmc.Year}, {gmc.Logo} {gmc.Model}" + $"\nWe call it the {gmc.Name}. Does it have a truck bed? That is {gmc.HasTruckBed}. \nIt's bed is {gmc.TruckBedSize}, " + $"{gmc.NumberOfDoors} doors, and it is {gmc.Color}.\n \nThe {jeep.GetType().Name} is a {jeep.Year}, {jeep.Logo} {jeep.Model}" + $"\nWe call it the {jeep.Name}. Does it have a hatch back? That is {jeep.HasHatchBack}. \nIt has {jeep.NumberOfSeats} seats, " + $"{jeep.NumberOfDoors} doors, and it is {jeep.Color}."); Console.WriteLine(); Console.WriteLine("For organizational pourposes we will list these out."); Console.WriteLine(); Console.WriteLine($"For {honda.GetType().Name}, {honda.Logo}, {honda.Model} " + $"\nColor: {honda.Color} \nNumber of Doors: {honda.NumberOfDoors}\nYear: {honda.Year}\nNumber of Seats: {honda.NumberOfSeats}\nTrunk: {honda.HasTrunk}."); Console.WriteLine(); Console.WriteLine($"For {gmc.GetType().Name}, {gmc.Logo}, {gmc.Model} " + $"\nColor: {gmc.Color} \nNumber of Doors: {gmc.NumberOfDoors}\nYear: {gmc.Year}\nTruck Bed: {gmc.HasTruckBed}\nTrunk Bed Size: {gmc.TruckBedSize}."); Console.WriteLine(); Console.WriteLine($"For {jeep.GetType().Name}, {jeep.Logo}, {jeep.Model} " + $"\nColor: {jeep.Color} \nNumber of Doors: {jeep.NumberOfDoors}\nYear: {jeep.Year}\nNumber of Seats: {jeep.NumberOfSeats}\nHatch Back: {jeep.HasHatchBack}."); }
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 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() { IsElectric = true, IsNew = true, Logo = "something", Name = "something else", NumDoors = 4, NumWheels = 4, NumberItSeats = 4, TrunkSize = 2 }; Truck myTruck = new Truck() { IsElectric = true, IsNew = true, Logo = "something", Name = "something else", NumDoors = 4, NumWheels = 4, BedSize = 6, HaulAmount = 2000 }; SUV mySUV = new SUV() { IsElectric = true, IsNew = true, Logo = "something", Name = "something else", NumDoors = 4, NumWheels = 4, CargoSize = 3, SeatsFold = true }; }
//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 /*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--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; //Creatively display and organize their values static void Main(string[] args) { Car car = new Car(); Truck truck = new Truck(); SUV suv = new SUV(); var vehhicles = new List <IVehicle> { car, truck, suv }; var company = new List <ICompany> { car, truck, suv }; foreach (var vehicle in vehhicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); Console.WriteLine(vehicle.Salary); Console.WriteLine(vehicle.DressCode); Console.WriteLine($"The vehicle has {vehicle.DoorAmount} doors. The vehicle is {vehicle.Color}. " + $"There are 4 tires on this vehicle: {vehicle.isFourTires = false}. The windows {vehicle.Windows} "); Console.WriteLine("------------------"); } }
static void Main(string[] args) { var car = new Car(); var truck = new Truck(); var vehicles = new List <IVehicle>() { car, truck }; car.PaintColor = "Black"; var nissan = new Car(); nissan.PaintColor = "White"; nissan.HasSunroof = true; nissan.NumDoors = 4; nissan.HasRadio = true; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); } Console.WriteLine("________________________________________________________________________"); var chevrolet = new SUV(); var fordexpedition = new SUV(); var fordexplorer = new SUV(); var acuraMDX = new SUV(); var sportUtilities = new List <IVehicle>() { chevrolet, fordexpedition, fordexplorer, acuraMDX }; foreach (var vehicle1 in sportUtilities) { vehicle1.Drive(); vehicle1.ChangeGears(true); vehicle1.Park(); vehicle1.Reverse(); } var listOfSuv = new List <IVehicle>() { chevrolet, fordexpedition, fordexplorer, acuraMDX }; foreach (var sportUtility in listOfSuv) { sportUtility.Drive(); sportUtility.Reverse(); } Console.WriteLine($"This is the list of cars:"); Console.WriteLine($"{sportUtilities}"); }
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 porche = new Car() { CompanyName = "Porche", GasMileage = 40, NumOfSeats = 5, NumOfWheels = 4, Slogan = "Somethin bout being fancy IDK", TrailerCapability = false, TrunkSpace = 7, Year = 2018 }; var F250 = new Truck() { CompanyName = "Ford", GasMileage = 20, NumOfSeats = 5, NumOfWheels = 4, Slogan = "Be a BIG MAN TRUCK", Year = 2018, BedSize = 10, CarryWeight = 4000 }; var jeep = new SUV() { CompanyName = "Jeep", GasMileage = 30, NumOfSeats = 4, NumOfWheels = 4, Slogan = "My horn goes'Jeep-Jeep'", Year = 2018, CargoHoldSpace = 5, RoofRack = true }; Console.WriteLine($"The Porche {porche.Year} by {porche.CompanyName} has a whopping {porche.GasMileage} MPG!"); Console.WriteLine($"{porche.NumOfSeats} seats!"); Console.WriteLine($"and a roomy trunk with {porche.TrunkSpace} cubic feet of space!"); Console.WriteLine($""); Console.WriteLine($"Next we have the F250 {F250.Year} by {F250.CompanyName}! {F250.Slogan}"); Console.WriteLine($"{F250.GasMileage} MPG, and with a roomy cabin space fit for {F250.NumOfSeats}!"); Console.WriteLine($"It's carry weight is a MASSIVE {F250.CarryWeight} Lbs!"); Console.WriteLine($""); Console.WriteLine($"Aaaaaand lastly we have the Jeep {jeep.Year} by Jeep! {jeep.Slogan}"); Console.WriteLine($"It's a Jeep... That's it"); }
static void Main(string[] args) { Car myFirstCar = new Car { Year = "2005", Make = "Mazda", Model = "Protege5", NumberOfDoors = 4, NumberOfWheels = 4 }; Truck myFirstTruck = new Truck { Year = "2012", Make = "Chevy", Model = "Z71", NumberOfWheels = 4, NumberOfDoors = 4, BedSize = 6, HasToolBox = true }; SUV myFirstSUV = new SUV { Year = "2010", Make = "Toyota", Model = "4Runner", NumberOfWheels = 4, NumberOfDoors = 4, CargoSize = 4, HasThirdRowSeating = false }; List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(myFirstCar); vehicles.Add(myFirstTruck); vehicles.Add(myFirstSUV); foreach (IVehicle vehicle in vehicles) { Console.WriteLine($"Year: {vehicle.Year} Make: {vehicle.Make} Model: {vehicle.Model} Number of Wheels: {vehicle.NumberOfWheels} Number of Doors: {vehicle.NumberOfDoors}"); Console.WriteLine(); vehicle.Drive(); 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; Truck myTruck = new Truck(); myTruck.Color = "black"; myTruck.IsCommercial = false; Car myCar = new Car() { HasTrunk = true }; //Paramaterized CTOR SUV mySUV = new SUV(true, "blue"); //Creatively display and organize their values Console.WriteLine($"Has a trailer {myTruck.HasTrailer}"); //purpose of Interfaces List <IVehicle> trucks = new List <IVehicle>(); trucks.Add(myTruck); trucks.Add(myCar); trucks.Add(mySUV); }
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.. */ Car myFirstCar = new Car { HasTrunk = true, Make = "Acura", Model = "TSX", Year = "2009", HasNosKit = true, ColorScheme = "Blue and Black", Logo = "Acura 'A'" }; Truck myFirstTruck = new Truck { HasBed = true, Make = "Nissan", Model = "SV6", Year = "1985", HasLiftKit = false, ColorScheme = "Red", Logo = "Nissan Logo" }; SUV myFirstSuv = new SUV { HasTrunk = true, Make = "Chevrolet", Model = "Yukon", Year = "2010", ColorScheme = "Yellow", Logo = "Yellow Chevy Logo" }; List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(myFirstCar); vehicles.Add(myFirstTruck); vehicles.Add(myFirstSuv); foreach (IVehicle vehicle in vehicles) { Console.WriteLine($"Year :{vehicle.Year} Make: {vehicle.Make} Model: {vehicle.Model} Logo: {vehicle.Logo} CholorScheme: {vehicle.ColorScheme}"); vehicle.Drive(); } //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) { //Complete TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //Complete Create 2 Interfaces called IVehicle & ICompany //Complete Create 3 classes called Car , Truck , & SUV //Complete In your IVehicle /* Create 4 members that Car, Truck, & SUV all have in common. * Example: All vehicles have a number of wheels... for now.. */ //Complete In ICompany /*Create 2 members that are specific to each every company * regardless of vehicle type. * * * Example: public string Logo { get; set; } */ //Complete 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 vehicles = new List <IVehicle>(); Car ride = new Car { Make = "Chevy", Model = "Corvette", Year = 2021, HorsePower = "490 HP", CruiseControl = true, Slogan = "Find New Roads", Color = "Blue", Logo = "Bowtie" }; Truck hauler = new Truck { Make = "Ford", Model = "Raptor", Year = 2021, BedSize = "66 inches", ExtendedCabin = true, Slogan = "Built Ford Tough", Color = "Red", Logo = "Ford name circled in Blue and white" }; SUV hybrid = new SUV { Make = "Honda", Model = "CRV EXL", Year = 2021, PassegerCapacity = 5, RearViewCamera = true, Slogan = "The Power of Dreams", Color = "Black", Logo = "Capital H in a distinctive design Design" }; vehicles.Add(ride); vehicles.Add(hauler); vehicles.Add(hybrid); ride.Display(); hauler.Display(); hybrid.Display(); }
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 }; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); Console.WriteLine($"EngineSize; {vehicle.EngineSize} Model: {vehicle.Model} Motto: {vehicle.Motto} Make: {vehicle.Make} SeatCount: {vehicle.SeatCount} HeasChangedGears: {vehicle.HasChangedGears}"); Console.WriteLine("-----------"); } //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE 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) { //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(); var truck = new Truck(); var suv = new SUV(); var vehicles = new List <IVehicle> { car, truck, suv }; foreach (var vehicle in vehicles) { vehicle.AboutCar(); vehicle.Drive(); vehicle.GearShift(true); vehicle.Reverse(); } }
public static void VehSales(SUV x) { Console.WriteLine($"{x.Year} {x.CompaName} {x.Logo} {x.Model}: {x.WheelCount} good wheels, {x.DoorCount} doors, {x.CargoHoldSize} cubic feet of cargo space."); if (x.SpareTire == true) { Console.WriteLine("and unlike some newer models it comes with an actual spare tire instead of a can of fix-a-flat!\n"); } else { Console.WriteLine("\n"); } }
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 vehicleList = new List <IVehicle>(); var newCar = new Car("Sedan", "Honda", true, "automatic"); var newTruck = new Truck("Ford", "diesel", 96.5); var newSUV = new SUV("Jeep", "sport", 65.7); vehicleList.Add(newCar); vehicleList.Add(newSUV); vehicleList.Add(newTruck); foreach (var vehicle in vehicleList) { Console.WriteLine($"Engine Type: {vehicle.EngineType}"); Console.WriteLine($"Number of Wheels: {vehicle.NumWheels}"); } newCar.Drive(); newTruck.HaulTrailer(); newSUV.GoOffroad(); newCar.MakeMoney(); }
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 /*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(); Truck myTruck = new Truck(); SUV mySUV = new SUV(); myCar.Color(); myCar.CompanyName(); myCar.CompanySlogan(); myCar.Doors(); Console.WriteLine($"{myCar.DoorsQnty}"); myTruck.Color(); myTruck.CompanyName(); myTruck.Doors(); Console.WriteLine($"{myTruck.FourWheelDrive}"); mySUV.CargoSize(); mySUV.Color(); }
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 vehic1 = new Car() { Make = "Chevy", Model = "Nova", Year = "1965" }; var vehic2 = new Truck() { Make = "Toyota", Model = "Tacoma", Year = "1995", Has4WheelDrive = true }; var vehic3 = new SUV() { Make = "Honda", Model = "CRV", Year = "2010" }; var vehicles = new List <IVehicle>() { vehic1, vehic2, vehic3 }; foreach (var v in vehicles) { Console.WriteLine($"Make: {v.Make}, Model: {v.Model}, Year: {v.Year}"); v.Drive(); } }
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 //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 var offRoad = new SUV(12, true, 4, true, "Jeep", 5, "front of a vehicle", 10000); var workTruck = new Truck(15, 7700, 4, true, "Chevrolet", 4, "short cross", 10002); var raceCar = new Car(false, true, 4, true, "Bugatti", 2, "red oval", 5000); var li = new List <IVehicle>(); li.Add(raceCar); li.Add(workTruck); li.Add(offRoad); foreach (IVehicle veh in li) { Console.WriteLine($"This vehicle is a {veh.GetType().Name}. It's a {veh.Make} that holds {veh.Passengers} passengers."); } }
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; SUV caddy = new SUV(); caddy.leatherSeats = true; Car honda = new Car(); honda.windowTint = true; Truck ford = new Truck(); ford.hasBackSeat = false; Console.WriteLine($"Yes that is {caddy.leatherSeats}, my Caddy does have leather seats!"); Console.WriteLine($"Yes that is {honda.windowTint}, my Honda does have window tint!"); Console.WriteLine($"No that is {ford.hasBackSeat}, my Ford does not have a backseat"); }
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 }; foreach (var vehicle in vehicles) { Console.WriteLine($"This is a {vehicle.Year} {vehicle.Model} and needs {vehicle.FuelType} to run properly"); 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 - 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. - DONE * */ //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values - DONE var SUV1 = new SUV(); var Car1 = new Car(); var Truck1 = new Truck(); SUV1.Wheels = 4; Car1.Muffler = true; Truck1.BigTires = true; Console.WriteLine($"My SUV has {SUV1.Wheels} wheels"); }
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("Nissan", "Nissan Logo", "Sentra", "Black", 2019, "Black"); var truck = new Truck("Nissan", "Nissan Logo", "Titan", "Crew Cab", 2018, 8000, "White"); var suv1 = new SUV("Nissan", "Nissan Logo", "Pathfinder", true, 2017, "Silver"); car1.DisplayCar(); truck.DisplayTruck(); suv1.DisplaySUV(); }
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 }; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.Park(); vehicle.ChangeGears(true); vehicle.Reverse(); } }
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 }; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.HasChangedGears(true); vehicle.Reverse(); } }
static void Main(string[] args) { //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values Car car = new Car(); Truck truck = new Truck(); SUV suv = new SUV(); car.TrunkSize = 20; car.Model = "Focus"; car.Name = "Ford"; car.NumTires = 4; car.Slogan = "Built Ford Tough"; car.Year = 2014; car.NumDoors = 4; car.HasSpareTire = true; truck.Model = "Ford"; truck.Name = "F150"; truck.NumDoors = 4; truck.NumTires = 4; truck.BedSize = 40; truck.Slogan = "Built Ford Tough"; truck.TowCapacity = 2900; truck.Year = 2020; suv.Model = "Griffin"; suv.Name = "Ascalon"; suv.NumTires = 8; suv.HasEScreen = true; suv.Slogan = "I eat people"; suv.NumDoors = 12; suv.Year = 2150; suv.CargoSpace = 0; Console.WriteLine("Display all long and drawn out properties here, like so: "); Console.WriteLine($"This SUV is made by {suv.Name} in the year {suv.Year}."); Console.WriteLine($"It has {suv.NumDoors} doors and {suv.NumTires} tires."); Console.WriteLine("That's all to see here."); }
static void Main(string[] args) { //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values var myCar = new Car(); var myTruck = new Truck(); var mySUV = new SUV(); var vehicles = new List <IVehicle>() { myCar, mySUV, myTruck }; foreach (var veh in vehicles) { veh.Drive(); veh.Reverse(); veh.Park(); 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 }; foreach (var vehicle in vehicles) { vehicle.Drive(); vehicle.ChangeGears(true); vehicle.Reverse(); } Console.WriteLine($"Do you have a car, truck or SUV?"); Console.ReadLine(); }
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. * */ Car porsche = new Car() { }; Console.WriteLine($"Introducing the new {porsche.CompanyName}, with its {porsche.EngineSize} engine you can expect great gas mileage. Its {porsche.IsAllWheelDrive} this puppy is all wheel drive" + $"And with {porsche.NumOfDoors} doors it can get your whole family from a to b at speeds up to {porsche.TopSpeed}mph. With {porsche.NumOfWheels} pirelli tires this thing is slick! Dont forget about that {porsche.Logo} head on the hood!"); var denali = new Truck() { CompanyName = "Gmc", EngineSize = "Enormous", IsDiesel = true, Logo = "GMC", HasLongBed = false, NumOfWheels = 4, IsDrivable = true, TopSpeed = 165 }; Console.WriteLine($"Introducing the new {denali.CompanyName}, with its {denali.EngineSize} engine you can expect reasonable gas mileage. Its {denali.IsDiesel} this puppy is all deisel" + $"And to say this truck has a long bed is {denali.HasLongBed}. Though with all the power you can travel at speeds up to {denali.TopSpeed}mph. With {denali.NumOfWheels} pirelli tires this thing is slick! Dont forget about that {denali.Logo} on the hood!"); SUV Suburban = new SUV() { CompanyName = "Gmc", EngineSize = "Enormous", IsLifted = true, Logo = "GMC", IsGasHog = false, NumOfWheels = 4, IsDrivable = true, TopSpeed = 165 }; Console.WriteLine($"Introducing the new {Suburban.CompanyName}, with its {Suburban.EngineSize} engine you can expect incredible gas mileage. Its {Suburban.IsDrivable} this puppy is all Luxury." + $"And to say this SUV sucks down gas is {Suburban.IsGasHog} with our new hybrid engine. Though with all the power you can travel at speeds up to {Suburban.TopSpeed}mph. With {Suburban.NumOfWheels} pirelli tires this thing is slick! Dont forget about that {Suburban.Logo} on the hood!"); ; //Now, create objects of your 3 classes and give their members values; //Creatively display and organize their values }
static void Main(string[] args) { #region Comments //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 and 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. * */ #endregion //Now, create objects of your 3 classes and give their members values; Car firstCar = new Car() { Year = 2012, Make = "Honda", Model = "accord", HasMotto = true, HasLogo = true, DriveAble = true }; Truck firstTruck = new Truck() { Year = 2013, Make = "Chevrolet", Model = "1500", HasMotto = true, HasLogo = true, DriveAble = true }; SUV firstSUV = new SUV() { Year = 2011, Make = "Toyota", Model = "Highlander", HasLogo = true, HasMotto = true, DriveAble = true }; List <ICompany> iCompanies = new List <ICompany>(); List <IVehicle> iVehicles = new List <IVehicle>(); iCompanies.Add(firstTruck); iCompanies.Add(firstCar); iCompanies.Add(firstSUV); iVehicles.Add(firstTruck); iVehicles.Add(firstCar); iVehicles.Add(firstSUV); foreach (IVehicle vehicle in iVehicles) { Console.WriteLine($"{vehicle.Year} {vehicle.Make} {vehicle.Model}."); } Console.WriteLine("======================"); foreach (ICompany company in iCompanies) { Console.WriteLine($"{company.HasMotto} {company.HasLogo}"); } }
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 //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 * * *Done --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 car1 = new Car(); Truck truck1 = new Truck(); SUV suv1 = new SUV(); car1.Color = "Red"; car1.Year = 1998; car1.Make = "Pontiac"; car1.Model = "Prowler"; truck1.Color = "Blue"; truck1.Year = 2021; truck1.Make = "Toyota"; truck1.Model = "Tundra"; suv1.Color = "Pearl White"; suv1.Year = 2022; suv1.Make = "Lexus"; suv1.Model = "G460"; //Done -- Creatively display and organize their values List <IVehicle> vehicles = new List <IVehicle>(); vehicles.Add(car1); vehicles.Add(truck1); vehicles.Add(suv1); foreach (IVehicle vehicle in vehicles) { Console.WriteLine($"Year: {vehicle.Year} Color: {vehicle.Color} Make: {vehicle.Make} Model: {vehicle.Model} "); Console.WriteLine(); } Console.WriteLine($"Is the car a 4 door? {car1.IsFourDoor}. The trunk size is {car1.TrunkSize} square feet!"); Console.WriteLine(); Console.WriteLine($"The bed size of the truck is {truck1.BedSize} square feet and the horsepower is {truck1.HorsePower}!"); Console.WriteLine(); Console.WriteLine($"The SUV has cargo space in the amount of {suv1.CargoSize} square feet."); Console.WriteLine($"The SUV on a car platform? {suv1.CarPlatform}."); }
static void Main(string[] args) { //TODO Be sure to follow BEST PRACTICES when creating classes and interfaces //DONE Create 2 Interfaces called IVehicle & ICompany //Create 3 classes called Car , Truck , & SUV //In your IVehicle /* DONE Create 4 members that Car, Truck, & SUV all have in common. * DONE 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 /*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 car = new Car(); car.carEconomy = true; car.carSound = "Vroom"; car.EngineSize = 400.3; car.Logo = "Mountain image"; car.SeatCount = 5; car.Make = "BMW"; car.Model = "385i"; car.MySlogan = "Driving is our American Pleasure"; Truck truck = new Truck(); truck.LenghtOfBed = 9; truck.NumberOfWheels = 8; truck.Logo = "Punsisher Image"; truck.Make = "Long Bed"; truck.Model = "Ford"; truck.Slogan = "Hit the Road with us!"; truck.EngineSize = 8.5; SUV suv = new SUV(); suv.isFourWheel = true; suv.isOffRoad = true; Console.WriteLine($" This is the car {car.Make} and the slogan is {car.MySlogan}"); Console.WriteLine($" This is the length of the bed {truck.SeatCount}"); Console.WriteLine($" This is the SUV it is {suv.isFourWheel} that is is a 4 wheel"); }