This class contains a few methods for some common List operations
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            // ListMethods listMethodsObject = new ListMethods();
            //int smallest = listMethodsObject.FindSmallestNumber(aList);

            int smallest = ListMethods.FindSmallestNumber(aList);

            Console.WriteLine("The smallest number in the list is : {0}", smallest);

            //int average = listMethodsObject.FindAverage(aList);

            int average = ListMethods.FindAverage(aList);

            Console.WriteLine("The average of the list is : {0}", average);

            Car car1 = new Car("AB55666", 1000);
            Car car2 = new Car("BW77333", 5000);
            Car car3 = new Car("GH55222", 10000);

            Console.WriteLine(Car.NoOfObjectCars);
            Console.WriteLine(Car.GetLincePlate);
            Console.WriteLine(Car.GetPrice);
            Console.WriteLine(Car.PrintUsageStatistics());

            // The LAST line of code should be ABOVE this line
        }
Beispiel #2
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            Car CarA = new Car("Bil1", 123456);
            Car CarB = new Car("Bil2", 123556);
            Car CarC = new Car("Bil3", 143456);

            CarB.LicensePlate = "blablabla";
            System.Console.WriteLine(CarB.LicensePlate);

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            int smallest = ListMethods.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = ListMethods.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");
            #endregion

            Car.PrintUsageStatistics();

            // The LAST line of code should be ABOVE this line
        }
Beispiel #3
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };
            // ListMethods listMethodsObject = new ListMethods();
            Car Ferrari = new Car("504SKF", 299384);
            Car BMW     = new Car("738KDG", 5094593);
            Car Porsche = new Car("326JSR", 98033966);
            Car Audi    = new Car("953FHT", 9695483);

            Car.PrintUsageStatistics();
            System.Console.WriteLine($"{Ferrari.Price} {BMW.LicensePlate} {Porsche.Price} {Audi.Price}");
            Car.PrintUsageStatistics();

            System.Console.WriteLine($"The licenceplate is {Ferrari.LicensePlate} and the price is {Ferrari.Price}");

            int smallest = ListMethods.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = ListMethods.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");
            #endregion

            // The LAST line of code should be ABOVE this line
        }
Beispiel #4
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            int smallest = ListMethods.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = ListMethods.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");
            #endregion

            Car hatchBack = new Car("3EME926", 5000);
            Car sedan     = new Car("XOS 846", 6969);
            Car mPV       = new Car("JX 9817", 4000);
            Car sUV       = new Car("8DR 592", 8000);

            hatchBack.Price = 300000;
            sedan.Price     = 200000;
            Console.WriteLine(hatchBack.Price);
            Console.WriteLine(hatchBack.LicensePlate);
            Console.WriteLine(mPV.LicensePlate);

            Car.PrintUsageStatistics();

            // The LAST line of code should be ABOVE this line
        }
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            //ListMethods listMethodsObject = new ListMethods();

            //int smallest = listMethodsObject.FindSmallestNumber(aList);
            int smallest = ListMethods.FindSmallestNumber(aList);

            Console.WriteLine("The smallest number in the list is : {0}", smallest);

            //int average = listMethodsObject.FindAverage(aList);
            int average = ListMethods.FindAverage(aList);

            Console.WriteLine("The average of the list is : {0}", average);



            Car car1 = new Car("XM46773", 10000);
            Car car2 = new Car("MF22334", 22222);
            Car car3 = new Car("OO00000", 999999);

            Console.WriteLine("Car2 price: " + car2.Price);
            Console.WriteLine("Car3 licenseplate: " + car3.LicensePlate);

            Car.PrintUsageStatistics();

            // The LAST line of code should be ABOVE this line
        }
Beispiel #6
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            int smallest = ListMethods.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = ListMethods.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");
            #endregion


            #region Car test
            Car car1 = new Car("ABC 123", 15000);
            Car car2 = new Car("DEF 456", 22000);
            Car car3 = new Car("HIJ 789", 8000);

            car1.LicensePlate = "CBA 321";
            car2.LicensePlate = "FED 654";
            car3.Price        = 12000;

            Console.WriteLine(car1.LicensePlate);
            Console.WriteLine(car3.Price);

            Car.PrintUsageStatistics();
            #endregion

            // The LAST line of code should be ABOVE this line
        }
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };
            ListMethods listMethodsObject = new ListMethods();

            int smallest = listMethodsObject.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = listMethodsObject.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");
            #endregion

            // The LAST line of code should be ABOVE this line
        }
Beispiel #8
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            #region ListMethods test
            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };

            int smallest = ListMethods.FindSmallestNumber(aList);
            Console.WriteLine($"The smallest number in the list is : {smallest}");

            int average = ListMethods.FindAverage(aList);
            Console.WriteLine($"The average of the list is : {average}");

            Car.PrintUsageStats();
            Car car1 = new Car("test", 5000);
            System.Console.WriteLine($"{car1.Price} {car1.LicensePlate}");
            Car.PrintUsageStats();
            #endregion

            // The LAST line of code should be ABOVE this line
        }
Beispiel #9
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            List <int> aList = new List <int> {
                23, 86, 51, 11, 39
            };


            int smallest = ListMethods.FindSmallestNumber(aList);

            Console.WriteLine("Smallest number in the list is: {0}", smallest);

            int average = ListMethods.FindAverage(aList);

            Console.WriteLine("The average of the list is: {0}", average);

            Car minbil  = new Car("abc123", 12000);
            Car minbil2 = new Car("dsf456", 40000);
            Car minbil3 = new Car("asdk72", 130000);


            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);
            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);
            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);
            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);
            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);
            Console.WriteLine(minbil.LicensePlate);
            Console.WriteLine(Car.PlateTracker);

            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);
            Console.WriteLine(minbil.Price);
            Console.WriteLine(Car.PriceTracker);



            //ListMethods listMethodsObject = new ListMethods();

            //int smallest = listMethodsObject.FindSmallestNumber(aList);
            //Console.WriteLine("The smallest number in the list is : {0}", smallest);

            //int average = listMethodsObject.FindAverage(aList);
            //Console.WriteLine("The average of the list is : {0}", average);

            // The LAST line of code should be ABOVE this line
        }