Ejemplo n.º 1
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            // Test of basis account
            Console.WriteLine();
            Console.WriteLine("Test of basis account");
            BasicAccount basicAcc = new BasicAccount("Mr. Basic", 1);
            PrintAccountInformation(basicAcc);

            basicAcc.Deposit(3000);
            PrintAccountInformation(basicAcc);

            basicAcc.Deposit(3000);
            basicAcc.Deposit(3000);
            basicAcc.Deposit(3000);
            basicAcc.Deposit(3000);
            PrintAccountInformation(basicAcc);

            basicAcc.Withdraw(1000);
            PrintAccountInformation(basicAcc);

            basicAcc.Withdraw(1000);
            basicAcc.Withdraw(1000);
            basicAcc.Withdraw(1000);
            basicAcc.Withdraw(1000);
            PrintAccountInformation(basicAcc);


            // Test of savings account
            Console.WriteLine();
            Console.WriteLine("Test of savings account");
            SavingsAccount savingsAcc = new SavingsAccount("Mr. Savings", 2, 10000);
            PrintAccountInformation(savingsAcc);

            savingsAcc.Deposit(3000);
            PrintAccountInformation(savingsAcc);

            savingsAcc.Deposit(3000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Deposit(3000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Deposit(3000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Deposit(3000);
            PrintAccountInformation(savingsAcc);

            savingsAcc.Withdraw(1000);
            PrintAccountInformation(savingsAcc);

            savingsAcc.Withdraw(1000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Withdraw(1000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Withdraw(1000);
            PrintAccountInformation(savingsAcc);
            savingsAcc.Withdraw(1000);
            PrintAccountInformation(savingsAcc);



            // Test of young limited account
            Console.WriteLine();
            Console.WriteLine("Test of young limited account");
            YoungLimitedAccount ylAcc = new YoungLimitedAccount("Mr. Limited", 3, 2000);
            PrintAccountInformation(ylAcc);

            ylAcc.Deposit(3000);
            PrintAccountInformation(ylAcc);

            ylAcc.Deposit(3000);
            ylAcc.Deposit(3000);
            ylAcc.Deposit(3000);
            ylAcc.Deposit(3000);
            PrintAccountInformation(ylAcc);

            ylAcc.Withdraw(1000);
            PrintAccountInformation(ylAcc);

            ylAcc.Withdraw(1000);
            PrintAccountInformation(ylAcc);
            ylAcc.Withdraw(1000);
            PrintAccountInformation(ylAcc);
            ylAcc.DailyMaintenance();
            ylAcc.Withdraw(1000);
            PrintAccountInformation(ylAcc);
            ylAcc.Withdraw(1000);
            PrintAccountInformation(ylAcc);




            // The LAST line of code should be ABOVE this line
        }
Ejemplo n.º 2
0
 public void PrintAccountInformation(BasicAccount acc)
 {
     Console.WriteLine("Account no. {0} owned by {1}, has a balance of {2} kr.", acc.GetAccountNo(), acc.GetOwnerName(), acc.GetBalance());
 }