Esempio n. 1
0
        static void Main(string[] args)
        {
            var myCar = new Car()
            {
                CountTires = 4, CompanyName = "Ford", CountDoors = 5, FoundationYear = 1903, MeanColor = "BlueNAvy",
            };
            var mySuv = new Suv()
            {
                CountTires = 4, CompanyName = "Toyota", FoundationYear = 1937, CountDoors = 5, HasBabySeat = false
            };
            var myTruck = new Truck()
            {
                CountTires = 16, CompanyName = "Honda", FoundationYear = 1948, CountDoors = 2, WeigthCapacity = 500
            };

            var vehiclesForSale = new List <IVehicle> {
                myCar, mySuv, myTruck
            };

            foreach (var vehicle in vehiclesForSale)
            {
                Console.WriteLine($"This is with {vehicle.CountDoors} doors and was bought at  {vehicle.ExactlyTimeWasBougth()}");
            }

            //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
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var myCar = new Car();

            myCar.Doors        = "6";
            myCar.Engine       = "V12";
            myCar.Transmission = "8-Speed";


            var myTruck = new Truck();

            myTruck.HasBed       = true;
            myTruck.Engine       = "V8";
            myTruck.Transmission = "8-Speed";



            var mySuv = new Suv();


            mySuv.HasRearDoor  = true;
            mySuv.Engine       = "V8";
            mySuv.Transmission = "8-Speed";



            Console.Write("Please select the type of vehicle you desire: Car, Truck or SUV" + " ");
            string line = Console.ReadLine();

            if (line == "Truck")
            {
                Console.WriteLine($"This truck was made by {myTruck.CompanyName} and has the following features. Doors:{myTruck.Doors}, Engine Size: {myTruck.Engine}, Transmission {myTruck.Transmission}.");
                Console.WriteLine($"Remember my friend: {myTruck.Slogan}");
            }
            else if (line == "SUV")
            {
                Console.WriteLine($"This CUV was made by {mySuv.CompanyName} and has the following features. Doors:{mySuv.Doors}, Engine Size: {mySuv.Engine}, Transmission {mySuv.Transmission}.");
                Console.WriteLine($"Great Selection: {mySuv.Slogan}");
            }
            else
            {
                Console.WriteLine($"This Car was made by {myCar.CompanyName} and has the following features. Doors:{myCar.Doors}, Engine Size: {myCar.Engine}, Transmission {myCar.Transmission}.");
                Console.WriteLine($"Great Selection: {myCar.Slogan}");
            }


            var vehicleList = new List <string>();

            vehicleList.Add("Toyota");
            vehicleList.Add("Sierra");
            vehicleList.Add("Tesla");

            foreach (var veh in vehicleList)
            {
                Console.WriteLine($"{veh}");
            }
        }
Esempio n. 3
0
        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

            //Now, create objects of your 3 classes and give their members values;
            //Creatively display and organize their values

            Car kia = new Car();

            kia.Logo                  = "KIA";
            kia.TrunkSize             = "small";
            kia.EngineSize            = "four cylinder";
            kia.WheelType             = "aluminum";
            kia.InteriorFabric        = "cloth";
            kia.Slogan                = "We wanna see ya in a Kia";
            kia.Color                 = "white";
            kia.automaticTransmission = true;

            Truck dodge = new Truck();

            dodge.BedSize        = "six feet";
            dodge.Color          = "black";
            dodge.EngineSize     = "eight cylinder";
            dodge.fourWheelDrive = true;
            dodge.InteriorFabric = "cloth";
            dodge.Logo           = "DODGE";
            dodge.Slogan         = "Guts. Glory. Ram";
            dodge.WheelType      = "chrome";

            Suv lexus = new Suv();

            lexus.CargoHoldSize  = "small";
            lexus.Color          = "gold";
            lexus.EngineSize     = "six cylinder";
            lexus.InteriorFabric = "leather";
            lexus.Logo           = "LEXUS";
            lexus.Slogan         = "The relentless pursuit of perfection";
            lexus.thirdRow       = true;
            lexus.WheelType      = "polished chrome";

            var vehicleList = new List <IVehicle>();

            vehicleList.Add(kia);
            vehicleList.Add(dodge);
            vehicleList.Add(lexus);

            foreach (var vehicle in vehicleList)
            {
                Console.WriteLine($"Color: {vehicle.Color} WheelType: {vehicle.WheelType} Interior: {vehicle.InteriorFabric} Engine Size: {vehicle.EngineSize}");
                Console.WriteLine("--------------------------------------------------------------------------------");
            }
        }
Esempio n. 4
0
        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.ChangedGears(true);
                vehicle.Reverse();
            }


            //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

            /*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
        }
Esempio n. 5
0
        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 corvette = new Car()
            {
                CarProperty     = "fastback",
                EngineCylinders = 8,
                Headquarters    = "Detroit, MI",
                Logo            = "Corvette Logo.jpg",
                NumSeats        = 2,
                NumWheels       = 4,
                TrunkSize       = 36,
                Year            = 2018
            };
            var f150 = new Truck()
            {
                BedSize         = 144,
                EngineCylinders = 8,
                Headquarters    = "Dearborn, MI",
                Logo            = "Ford-Tough Logo.png",
                NumSeats        = 2,
                NumWheels       = 4,
                TruckProperty   = "1/2-Ton",
                Year            = 2015
            };
            var acadia = new Suv()
            {
                CargoSize       = 50,
                EngineCylinders = 6,
                Headquarters    = "Detroit, MI",
                Logo            = "GMC Logo.jpg",
                NumSeats        = 8,
                NumWheels       = 4,
                SuvProperty     = "All-seat video",
                Year            = 2020
            };

            Console.WriteLine(corvette.MakeDescription() + "--------------");
            Console.WriteLine(f150.MakeDescription() + "--------------");
            Console.WriteLine(acadia.MakeDescription() + "--------------");
        }
Esempio n. 6
0
        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("---------------------------------------------------------------------------------------------------------------");
            }
        }