Java: Creating Savings Account To be able to work on this assignment, you will need a functional version of the BankAccount and Customer class from last week’s assignment. Your first task is to get this working.
Similar to previous assignments, you are expected to infer some of the requirements from the unit tests.
Add a third class called SavingsAccount which is a subclass of BankAccount.In addition to the methods and data provided by the parent class, SavingsAccount should include:
1. annualInterestRate – an instance variable of type double, which indicates an annual interest rate, which is between 0 and 1 (representing 0% to 100%).
2. minimumBalance – an instance variable of type double which represents the minimum balance required for the account.Withdrawals that would allow the balance in the account to go below this account should not be allowed. This will require you to override the withdraw method from the parent class.The child class (SavingsAccount) should only verify that there are sufficient funds in the account for the withdraw.If there is, it should invoke the withdraw method in the parent class.
3. depositMonthlyInterest() – a method which, on a monthly basis, calculates the amount of interest earned on the balance in the SavingsAccount, and adds this to the balance.
4. SavingsAccount should not contain any additional instance variables or methods.To update the balance in the account, the methods in SavingsAccount should call the methods in the parent class.
A JUnit test is provided below for SavingsAccount.(The classes BankAccount and Customer are unchanged so no additional tests are provided for this.)This tests not only the functionality but also the design of the class.
***There are total 11 test
Run JUnit test!! to check the work.
Use JUnit Test to test the code. (When it’s run, it should say that there are no errors/failures)
Create a new folder.
Put junit-4.12.jar and hamcrest-core-1.3.jar in this folder (available below).
Copy the test code with possible supporting files in this same folder.
Create the file with code as required.
Compile your code and the test code using the command javac -cp .;junit-4.12.jar:hamcrest-core-1.3.jar *.java
Run the test using the command “java -cp .;junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore SavingsAccountIA4Test