Students will write 3 classes: BankAccount.java, BankAcountDemo.java and Financial.java
the BankAccount.java class should have the following components:
5 instance variables : balance, accName, accNum, accountType, interestRate
1 static variable : lastAccNum = 0
2 constructors : default and an overloaded constructor that takes in 3 explicit parameters(balance, accName, and accountType) to initialize the fields. (demonstrate the use of the keyword "this"). The other two fields will be assigned values inside the constructor.
13 methods
4 setter methods : setBalance, setName, setAccountType, and setInterestRate
4 getter methods : getBalance, getName, getAccountType, and getInterestRate
a withdraw method
a deposit method
a transfer method
a displayAccountInfo method
an addInterest method that invokes the static method percentOf from the Financial class and takes in two parameters; the interestRate field and the balance field. In this method interest will be added only to savings accounts according to the interestRate value. You should NOT add interest to a checking account.
Note: after calculating the interest, you will need to add it to the balance.
The BankAccountDemo.java class should have the following:
Create 3 objects AdamsAcc (C), SamsAcc(S), and LeilasAcc(S) use the default constructor for the first object and the second constructor for second and third object.
you are free to test your code and use the methods on any objects, but make sure to:
invoke and demonstrate all the methods
Invoke the addInterest method two times; once with LeilasAcc and once with SamsAcc.
invoke the displayAccountInfo() method several times to show all the changes.
Final Step: add an exception to the withdraw method whenever the amount to be withdrawn exceeds the balance.
Test this by trying to withdraw an amount that is greater then the balance in your Demo class.
Take a snapshot of the the generated exception.