Esempio n. 1
0
        internal static void ChangeTypeAccount(Budget <Account> budget)
        {
            Console.WriteLine("Enter account number (id):");
            int id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter the account type:\n\t1. 'small' - SMALL type (limit 1,000 UAH).\n\t2. 'middle' - MIDDLE type (limit 20,000 UAH).\n\t3. 'premium' - PREMIUM type (limit 1,000,000 UAH).");
            AccountType acType;
            string      type = Convert.ToString(Console.ReadLine());

            switch (type)
            {
            case "small":
                acType = AccountType.Small;
                break;

            case "middle":
                acType = AccountType.Middle;
                break;

            case "premium":
                acType = AccountType.Premium;
                break;

            default:
                Console.WriteLine("Invalid account type specified. Please check your input.");
                throw new ArgumentException("acType must be: 'small', 'middle' or 'premium'");
            }
            budget.ChangeTypeAccount(id, acType);
        }