Beispiel #1
0
        static void Main(string[] args)
        {
            Account acc = AccountFactory.CreateAccount("RD");

            acc.Name      = "Phaniraj";
            acc.AccountNo = 23343;
            acc.Credit(5000);
            acc.CalculateInterest();
            Console.WriteLine($"The current balance:{acc.Balance}");//C# 7.0
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     try
     {
         Account acc = AccountFactory.CreateAccount(AccountType.RD);
         acc.AccountNo    = 111;
         acc.CustomerName = "Phaniraj";
         acc.Credit(5000);
         acc.Debit(400);
         acc.CalculateInterest();
         Console.WriteLine("The current balance:" + acc.Balance);
         acc.Debit(234456);
         Console.WriteLine("The current balance:" + acc.Balance);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }