Enhance the BankAccount class by adding preconditions for the constructor and the deposit method that require the amount parameter to be at least zero, and a precondition for the withdraw method that requires amount to be a value between 0 and the current balance. Use assertions to test the preconditions.

Complete the following file:

BankAccountTester2.java

Use the following file:

BankAccountTester.java

public class BankAccountTester
{
   public static void main(String[] args)
   {
      try
      {
         BankAccount a = new BankAccount(-1000);
         System.out.println("No assertion error");
      }
      catch (AssertionError e)
      {
         System.out.println("Assertion error");
      }
      System.out.println("Expected: Assertion error");
      
      try
      {
         BankAccount b = new BankAccount(1000);
         b.deposit(-1000);
         System.out.println("No assertion error");
      }
      catch (AssertionError e)
      {
         System.out.println("Assertion error");
      }
      System.out.println("Expected: Assertion error");

      try
      {
         BankAccount c = new BankAccount(1000);
         c.withdraw(2000);
         System.out.println("No assertion error");
      }
      catch (AssertionError e)
      {
         System.out.println("Assertion error");
      }
      System.out.println("Expected: Assertion error");

      try
      {
         BankAccount d = new BankAccount(1000);
         d.deposit(1000);
         d.withdraw(2000);         
         System.out.println("No assertion error");
      }
      catch (AssertionError e)
      {
         System.out.println("Assertion error");
      }
      System.out.println("Expected: No assertion error");
   }
}