Beispiel #1
0
        public MotoristsList(int n)
        {
            FileStream   file = new FileStream("labfile.txt", FileMode.Append);
            StreamWriter fnew = new StreamWriter(file);

            motorists = new Motorist[n];
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("Введите автолюбителя №{0}", i);
                motorists[i] = new Motorist();
                fnew.WriteLine("Автомобилист" + i + ":" + motorists[i].ToString());
            }
            fnew.Close();
        }
        static void Main(string[] args)
        {
            Motorist[] motorists = new Motorist[5];
            motorists[0] = new Motorist("Kawasaki", 1990, 32, 412, "зеленый", 1337, "Пупкин", "Вася", "Иннокентьевич");
            motorists[1] = new Motorist("Subaru", 2000, 312, 41232, "красный", 1917, "Багов", "Игорь", "Викторович");
            motorists[2] = new Motorist("Kawasaki", 2001, 22, 414, "красный", 2517, "Кеков", "Владимир", "Петрович");
            motorists[3] = new Motorist("Kawasaki", 1994, 233, 424, "красный", 322, "Иванов", "Иван", "Иванович");
            motorists[4] = new Motorist("Subaru", 2007, 1332, 814, "желтый", 322, "Шатохин", "Артем", "Павлович");
            MotoristsList motorist = new MotoristsList(motorists);

            motorist.OutputInfo();
            Console.WriteLine("---");
            motorist.AgeFilter(2018);
            motorist.ChosenMarkSameColor();
            Console.ReadKey();
        }
Beispiel #3
0
        public int CompareTo(object obj) //Реализуем сравнение для цвета
        {
            Motorist temp = (Motorist)obj;

            return(color.CompareTo(temp.color));
        }