private static void TestDepositAccounts() { Customer haron = new Individual("Haron", "Kipkorir"); Customer bugati = new Company("Bugatti cars"); Customer trendyCollection = new Company("Trendy T Collections"); Customer kuddah = new Individual("Anthony", "Karuen"); Account haronAccount = new DepositAccount(haron, 1200, 1.5f); Account bugatiAccount = new DepositAccount(bugati, 1.6f); Account kuddahAccount = new DepositAccount(kuddah, -200, 2.3f); Account trendyAccount = new DepositAccount(trendyCollection, 5200, 2.3f); Console.WriteLine(haronAccount); double interest = haronAccount.CalculateInterest(12); Console.WriteLine("Haron Interest: {0}", interest); Console.WriteLine("Account balance after withdrawal: {0}", haronAccount.Withdraw(400d)); Console.WriteLine("Haron's Interest after withdrawal: {0}", haronAccount.CalculateInterest(12)); Console.WriteLine("Account balance after withdrawal: {0}", haronAccount.Withdraw(900)); Console.WriteLine(); Console.WriteLine(bugatiAccount); Console.WriteLine(kuddahAccount); Console.WriteLine(trendyAccount); kuddahAccount.Withdraw(200); interest = kuddahAccount.CalculateInterest(2); }
private static void TestBank() { Customer ilara = new Company("Ilara Yoghurt"); Customer bugati = new Company("Bugatti cars"); Customer blackCollection = new Company("Black Collections"); Customer haron = new Individual("Haron", "Kipkorir"); Customer brian = new Individual("Brian", "Smit"); Customer natLiv = new Individual("Natalie", "Olivia"); Account haronAccount = new DepositAccount(haron, 1200, 1.5f); Account ilaraAccount = new LoanAccount(ilara, 8700, 2.4f); Account bugatiAccount = new MortgageAccount(bugati, 1000, 2.3f); Account blackAccount = new DepositAccount(blackCollection, 1230, 1.3f); Account brianAccount = new LoanAccount(brian, 300, 0f); Account natLivAccount = new DepositAccount(natLiv, 200, 2.0f); Bank worldBank = new Bank("World Bank"); worldBank.Customers.Add(ilara); worldBank.Customers.Add(bugati); worldBank.Customers.Add(blackCollection); worldBank.Customers.Add(haron); worldBank.Customers.Add(brian); worldBank.Customers.Add(natLiv); worldBank.Accounts.Add(haronAccount); worldBank.Accounts.Add(ilaraAccount); worldBank.Accounts.Add(bugatiAccount); worldBank.Accounts.Add(blackAccount); worldBank.Accounts.Add(brianAccount); worldBank.Accounts.Add(natLivAccount); Console.WriteLine(worldBank); }