Пример #1
0
        public void Menu(List <Ryba> ryby)
        {
            Console.WriteLine("1. Filtruj.");
            Console.WriteLine("2. Srednia cena przefiltrowanych.");
            Console.WriteLine("3. Srednia waga przefiltrowanych.");
            Console.WriteLine("4. Wyswietl przefiltrowane.");
            Console.WriteLine("5. Dodaj rybe.");
            Console.WriteLine("e. Wyjscie.");
            List <Ryba> noweR = ryby;
            Statystyki  stats = new Statystyki(noweR);

            string choice = Console.ReadLine();

            while (choice != "1" && choice != "2" && choice != "3" && choice != "4" && choice != "5" && choice != "e")
            {
                choice = Console.ReadLine();
            }

            switch (choice)
            {
            case "1":
                Console.WriteLine("Od enterów po kolei: nazwa, opis, pora, gdzie zlowione i gdzie sprzedane.");
                string n   = Console.ReadLine();
                string op  = Console.ReadLine();
                string por = Console.ReadLine();
                string zl  = Console.ReadLine();
                string sp  = Console.ReadLine();
                noweR = stats.FiltrujStringi(ryby, n, op, por, zl, sp);
                Menu(noweR);
                break;

            case "2":
                Console.WriteLine(stats.SredniaCena(noweR));
                Menu(noweR);
                break;

            case "3":
                Console.WriteLine(stats.SredniaWaga(noweR));
                Menu(noweR);
                break;

            case "4":
                WyswietlWszystkie(noweR);
                Menu(noweR);
                break;

            case "5":
                dodajRybe(ryby);
                Menu(noweR);
                break;

            case "e":
                Environment.Exit(0);

                break;
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            List <Ryba> ryby  = new List <Ryba>();
            Operating   opera = new Operating(ryby);
            Statystyki  stats = new Statystyki(ryby);

            zPliku(ryby, opera);


            opera.Menu(ryby);



            Console.ReadKey();
        }