Exemple #1
0
        static void Meni(List <BankAccount> accounts)
        {
            accounts = new List <BankAccount>();
            int choice = 0;

            while (true)
            {
                Console.WriteLine("Odaberite opciju. \n");
                Console.WriteLine("1. Stvaranje novog racuna \n ");
                Console.WriteLine("2. Ispis svih racuna \n");
                Console.WriteLine("3. Izlaz \n");
                Console.WriteLine("\n");
                choice = Convert.ToInt32(Console.ReadLine());
                if (choice == 1)
                {
                    int choice2 = 0;
                    while (!Racun.IsDefined(typeof(Racun), choice2))
                    {
                        Console.WriteLine("Odaberite vrstu racuna");
                        Console.WriteLine("1. stednja ");
                        Console.WriteLine("2. Tekući Racun ");
                        Console.WriteLine("3. ziro racun ");
                        Console.WriteLine("\n");
                        choice2 = Convert.ToInt32(Console.ReadLine());
                    }
                    accounts.Add(new BankAccount(choice2));
                }
                else if (choice == 2)
                {
                    foreach (BankAccount account in accounts)
                    {
                        account.print();
                    }
                }
                else if (choice == 3)
                {
                    return;
                }
            }
        }