AddAccount() публичный Метод

public AddAccount ( Account account ) : void
account Account
Результат void
Пример #1
0
        static void Main(string[] args)
        {
            Bank fib = new Bank("First Investment Bank");
            IndividualCustomer pesho = new IndividualCustomer("Pesho");
            DepositAccount depositAccount = new DepositAccount(pesho, 2M, 0.05m);
            fib.AddCustomer(pesho);
            fib.AddAccount(depositAccount);

            depositAccount.Deposit(1000M);

            Console.WriteLine("Current blanace: " + depositAccount.Balance);

            Console.WriteLine("Interest amount: " + depositAccount.CalculateInterest(23));

            depositAccount.Withdraw(153.03M);
            Console.WriteLine("Current blanace: " + depositAccount.Balance);
        }
Пример #2
0
        //Method to add a new account into the bank
        public static void DoAddAccount(Bank bank)
        {
            try
            {
                Console.Write("Please enter the account name: ");
                string accountName = Console.ReadLine();

                Console.Write("Please enter the starting balance: ");
                decimal balanceAmount = Convert.ToDecimal(Console.ReadLine());

                Account acc = new Account(accountName, balanceAmount);

                bank.AddAccount(acc);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error! : " + e.Message);
            }
        }