Business Programming

Course announcements for INFS1609 and INFS2609

Business Programming random header image

Assignment 3 – UPDATE (04/10/2011)

Posted by on September 22nd, 2011 · Assignments

Due: 23:59:50 Sunday 9 October 2011

ChangeLog

  • Revision 04/10/2011: corrected error in RunTransactions
  • Revision 04/10/2011: Clarified use of  period.
  • Added submission instructions

Task

This assignment continues the theme of the earlier assignments, building a simple bank transaction system. In this program, you will use inheritance to create different kinds of accounts and transactions.

A skeleton for the program is provided here. It contains all the same classes as in assignment 2. Your task is to create two new subclasses of Account. One class, SavingsAccount, represents an interest bearing account. Periodically, a method in the SavingsAccount object will be called to calculate the interest for the period and generate a transaction to pay the account the account the interest. The interest formula is:

balance * interestRate/period

where interestRate is a number between 0 and 1 representing the annual interest rate (e.g. 4% interest = 0.04) and period is how often the interest is calculated (e.g. period = 12 means that the interest is calculated monthly).

A second subclass of account is CreditCard. Whereas a savings account is never allowed to have a negative balance, a CreditCard account may go negative. If the balance is negative, interest is calculated but this time, it is charged to the account. That is, the interest amount is subtracted from the balance.

Credit cards usually have a credit limit. That is, a customer cannot use the credit card if the balance has exceeded the credit limit. So transactions generated by the customer must be disallowed if the credit limit is exceeded. However, transactions generated by the bank when it charges interest can exceed the credit limit. That is, the bank can keep making your balance more and more negative but you can’t!

You should also create two subclasses of Transaction called, BankTransaction and CustomerTransaction to allow your program to distinguish between transactions that can and cannot exceed the credit limit.

This time, you are not given skeletons of the new classes or an API. There is enough information in the source code of the classes given to you that you should be able to work out what fields and methods your new classes need. For example, you should create methods:

public void setPeriod(int period)

public int getPeriod()

for getting and setting the interest rate period for each type of account.

Remember, you must not change any of the classes given to you in any way whatsoever except for RunTransactions. You can change that to add your own tests, although by now, you should be thinking of using BlueJ’s unit testing facilities.

Submission instructions

You will submit your assignment to the Give automated marked system.

  1. From within your assignment 3 BlueJ project, select Project -> Create Jar File…
  2. In the Dialog Box that appears:
    1. Set “Main Class” to none
    2. Ensure “Include Source” is checked
    3. Leave “Include Bluej project files” unchecked
  3. Press “Continue”
  4. Save the filename as “assignment3.jar”
  5. Open a web browser and go to the give web site
  6. Log-in with you Z-Pass
  7. Either enter “INFS1609” in for the course, or select INFS1609/INFS2609 from the drop down menu and press “Search for Assignments”. Note INFS2609 students may need to enter “INFS1609” instead of selecting INFS2609 if the assignment is not listed
  8. Select “assignment3” from the next drop down menu and press “Upload my Assignment”
  9. Accept the student declaration
  10. Press “Choose File” and select the “assignment3.jar” file that you saved in step 4
  11. Press “Submit my Files”
  12. Wait for the page to completely load. Then carefully read the output. If the assignment is successful you should see the following lines:
    Checking your submission...
    Checking for relevant classes...
    All files are OK
  13. If the page doesn’t load properly, that is OK just submit the assignment file again.
  14. If you see the final line, everything is good. Otherwise check the output to see what went wrong and resubmit.

Submission notes:

  1. You can submit as many times as you wish, even after the deadline. Only your last submission will be marked.
  2. Make sure you name everything the as instructed, including the classes and the submission file or the submission will not work.
  3. If you have any problems with submission, email the class account

No Comments so far ↓

Comments are closed.