public void Run() { // Test of basis account Console.WriteLine(); Console.WriteLine("Test of basis account"); BasicAccountSolution basicAcc = new BasicAccountSolution("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"); SavingsAccountSolution savingsAcc = new SavingsAccountSolution("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"); YoungLimitedAccountSolution ylAcc = new YoungLimitedAccountSolution("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); }
public void PrintAccountInformation(BasicAccountSolution acc) { Console.WriteLine("Account no. {0} owned by {1}, has a balance of {2} kr.", acc.GetAccountNo(), acc.GetOwnerName(), acc.GetBalance()); }