For this assignment, you are expected to infer some of the requirements from the unit tests. This includes string formats, exact names of methods, the order or arguments and the constructors required.
Create a Customer class with the following:
1. Instance variables with appropriate getter and setter methods: name, which is a String, and a customerID, which is an integer.
2. A toString() method which provides a well-formatted string representation of the instance variables in the Customer class.
3. Appropriate constructors for the class.
Update BankAccount class to:
1. Add an instance of the Customer class to your BankAccount class as an instance variable with a getter and setter method. The name of the instance variable should be accountHolder.
2. Add appropriate constructors to allow creation of bank accounts to specify an account holder.
3. Update the toString method such that the string returned includes account holder information.
4. Add a method called transfer that takes an amount to transfer and an account to transfer to as arguments. The transfer should only take place if the account has enough funds.
A JUnit test is provided below for both the updated BankAccount class (20 tests) and the Customer class (5 tests). To qualify for the full team grade you must pass at least 20/25 tests.
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 BankAccountIA3Test" and "java -cp .;junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore CustomerIA3Test"
Take a screenshot of cmd to show that file is working properly. If you need more information leave a question and I'll try to answer them ASAP. Thank you.