Пример #1
0
        public static void getReport4(int engSize)
        {
            try
            {
                Console.WriteLine("REPORT FOR ALL VEHICLES WITH AN ENGINE SIZE OVER 1100:");
                Console.WriteLine("VehicleID  RegNumber  Manufacturer   Model     EngineSize  RegDate     InteriorColour  HasHalmet  VehicleType");
                List <string> vehicles = VehicleDetails.getDetails();

                for (int i = 0; i < vehicles.Count; i++)
                {
                    string[] vehicleFields = vehicles[i].Split(',');
                    if (!vehicleFields[5].Equals(""))
                    {
                        int engineSize = Int32.Parse(vehicleFields[5]);
                        if (engineSize > engSize)
                        {
                            Console.WriteLine(vehicleFields[1] + "          " + vehicleFields[2] + "   " + vehicleFields[3] + "        " + vehicleFields[4] + "      " + vehicleFields[5] + "        " + vehicleFields[6] + "  " + vehicleFields[7] + "        " + vehicleFields[8] + "              " + vehicleFields[9]);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #2
0
        public static void getReport1()
        {
            try
            {
                Console.WriteLine("REPORT FOR ALL KNOWN CUSTOMERS AND ANY VEHICLES THEY OWN:");
                Console.WriteLine("CustomerID  ForeName  Surname  DateOfBirth  VehicleID  RegNumber  Manufacturer   Model     EngineSize  RegDate     InteriorColour  HasHalmet  VehicleType");
                List <string> customers = CustomerDetails.getDetails();
                List <string> vehicles  = VehicleDetails.getDetails();

                for (int i = 0; i < customers.Count; i++)
                {
                    string[] customerFields = customers[i].Split(',');
                    for (int j = 0; j < vehicles.Count; j++)
                    {
                        string[] vehicleFields = vehicles[j].Split(',');

                        if (customerFields[0] == vehicleFields[0])
                        {
                            Console.WriteLine(customerFields[0] + "           " + customerFields[1] + "       " + customerFields[2] + "    " + customerFields[3] + "   " + vehicleFields[1] + "          " + vehicleFields[2] + "   " + vehicleFields[3] + "       " + vehicleFields[4] + "      " + vehicleFields[5] + "        " + vehicleFields[6] + "  " + vehicleFields[7] + "        " + vehicleFields[8] + "              " + vehicleFields[9]);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Пример #3
0
 public static void getReport3(int Year)
 {
     try
     {
         Console.WriteLine("REPORT FOR ALL VEHICLES REGISTERED BEFORE 1ST JANUARY 2010:");
         Console.WriteLine("VehicleID  RegNumber  Manufacturer   Model     EngineSize  RegDate     InteriorColour  HasHalmet  VehicleType");
         List <string> vehicles = VehicleDetails.getDetails();
         for (int i = 0; i < vehicles.Count; i++)
         {
             string[] vehicleFields = vehicles[i].Split(',');
             if (!vehicleFields[6].Equals(""))
             {
                 DateTime regDate = DateTime.Parse(vehicleFields[6]);
                 if (regDate.Year < Year)
                 {
                     Console.WriteLine(vehicleFields[1] + "          " + vehicleFields[2] + "   " + vehicleFields[3] + "        " + vehicleFields[4] + "      " + vehicleFields[5] + "        " + vehicleFields[6] + "  " + vehicleFields[7] + "        " + vehicleFields[8] + "              " + vehicleFields[9]);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }