Individual Assignment 6 Solution



To be able to work on this assignment, you will need a functional version of the BankAccount, SavingsAccount and Customer class from team assignment 4. Your first task is to get this working. This assignment will require you to modify BankAccount and SavingsAccount.

Similar to previous assignments, you are expected to infer some of the requirements from the unit tests.

If you are facing difficulties in understanding JUnit tests, talk to your TA or instructor.

Update BankAccount to

  • Make BankAccount an abstract class.

  • Add abstract method getMonthlyFeesAndInterest with return type double and access protected.

  • Add method monthEndUpdate which doesn’t return anything but calls getMonthlyFeesAndInterest and updates the balance by the amount returned. (If the amount returned is negative, the balance is reduced, when the amount returned is positive the balance is increased.) It is possible that the account has a negative balance after this method is called.

Update SavingsAccount to

  • Remove the method depositMonthlyInterest

  • Override the getMonthlyFeesAndInterest method such that it returns the monthly interest. (Same computation as depositMonthlyInterest did, but the account balance is not changed.)

A JUnit test is provided for SavingsAccount (5 tests) and BankAccount (5 tests). Most of the tests for methods from previous assignments are removed for this individual assignment. The tests will be included for the team assignment. This tests not only the functionality but also the design of the classes. You’ll see an additional class included with the test classes (also included with this week’s coding challenges) called FormatTester. Make sure it is in the same folder as the other test classes. You do not otherwise need to do anything with this class.

Submit your SavingsAccount and BankAccount classes in a zip file to WebCAT. There are 10 tests in total. To qualify for the full team grade you must pass at least 8/10 tests.

error: Content is protected !!