More OOP: Exercise 3

Using everything you've learned so far about creating OOP 
classes, create a new class called BankAccount:

All bank accounts have the same interest rate of 2.5%.
Use the following UML:

BankAccount
-----------------------
+ i͟n͟t͟e͟r͟e͟s͟t͟R͟a͟t͟e : d͟o͟u͟b͟l͟e
- accountId : int
- balance : double
-----------------------
+ BankAccount(accountId : int)
+ BankAccount(accountId : int, balance : double)
+ getAccountId() : int
+ getBalance() : double
+ setAccountId(accountId : int) : void
+ setBalance(balance : double) : void
+ withdraw(amount : double) : void 
+ deposit(amount : double) : void
+ accountInfo() : String

- there's no default account ID (BankAccount never exists without
  one so there's no need for a default); account ID must be greater
  than 0,  otherwise an exception is thrown
- balance must be greater than 0, otherwise the default 
 is used; default is 0
- interest rate is always 2.5% but should be stored as a 
  decimal value for more efficient calculations
- withdraw() will only withdraw amount from balance if there 
  is enough money in the account, otherwise an exception 
  is thrown 
- deposit() will only deposit amount to balance if the 
  deposit amount is greater than 0, otherwise an exception 
  is thrown
- accountInfo() returns a String with the account state 
  in the form:
  Account: id
  Balance: $bb.bb 
  Rate: 0.rrr%
  (where id is the account id value, $bb.bb is the balance 
  formatted to 2 decimal places, and 0.rrr% is the interest 
  rate formatted to 3 decimal places with a % sign on the 
  right and a leading 0 if necessary)



Code I used to test BankAccount:
        BankAccount acct1 = new BankAccount(1);
        acct1.setBalance(1000);
        acct1.withdraw(500);
        System.out.println(acct1.accountInfo());
        acct1.deposit(250);
        System.out.println(acct1.accountInfo());
        System.out.println(acct1.getAccountId());
        System.out.println(acct1.getBalance());
        System.out.printf("Interest: %.2f\n", BankAccount.interestRate);
        acct1.setBalance(-1000);
        System.out.println(acct1.getBalance()); // should be 0
        BankAccount acct2 = new BankAccount(3, -400);
        System.out.println(acct2.accountInfo()); // check that balance is 0

        // testing exceptions - test one block at a time

        // checking withdraw() exception
        // BankAccount acct3 = new BankAccount(2, 500);
        // acct3.withdraw(700); // should throw exception
        
        // checking deposit() exception
        // BankAccount acct3 = new BankAccount(2, 500);
        // acct3.deposit(-700); // should throw exception

        // checking invalid id in constructor
        //BankAccount acct4 = new BankAccount(-1);

        // checking invalid id
        //BankAccount acct4 = new BankAccount(1);
        //acct4.setAccountId(-2);