static void Main(string[] args) { BankAccount account = new BankAccount("Mayql", 1230.70, 19.2); Console.WriteLine(account.ToString()); // Test that the initial balances must be positive try { var invalidAccount = new BankAccount("invalid", -10); } catch (InsufficientBalance e) { Console.WriteLine("Exception caught creating account with negative balance"); Console.WriteLine(e.ToString()); } //test that the interstrate must be between 0.0-22.0 try { account.AddInterest(36.8); } catch (InvalidInterstRateException e) { Console.WriteLine($"{e.Message}"); } Console.ReadKey(); }
static void Main(string[] args) { BankAccount myAccount = new BankAccount(0, 5); myAccount.Deposit(1000); myAccount.AddInterest(); Console.WriteLine("My current bank balance is $ {0:0.00}\n", myAccount.QueryBalance()); Console.WriteLine("\nPress enter to exit."); Console.ReadLine(); }