Business Programming

Course announcements for INFS1609 and INFS2609

Business Programming random header image

Assignment 2

Posted by on August 24th, 2011 · Assignments

Change Log

  • 2011-09-02 Added submission instructions

Task

This assignment extends assignment 1. Now that you have defined classes for accounts and transactions, the next step is to use collections to make a simple journal and ledger. A journal will be implemented as an ArrayList of transactions. A ledger will be implemented as a HashMap containing accounts, indexed by their account number. Why use different types of collections? For the journal, we only need to access the transactions sequentially, whereas accounts in the ledger have to be accessed by account number.

Your program will provide the following operations:

  • create a new journal
  • create a new ledger
  • create a new transaction and add it to a journal
  • process all the transactions in a journal, to update the accounts in the given ledger

When an individual transaction is processed, in addition to updating the balance of the account, the transaction should be stored in an ArrayList associated with the account, so that a report can be produced that shows all the transactions for each account. You do not have to write the report method. That will be provided.

Here as an example of the RunTransactions class for this assignment.

public class RunTransactions
{
    static void main()
    {
       // Create a new ledger, L
       Ledger L = new Ledger();

       // Create two new accounts with the given account numbers
       // Add the accounts to the ledger
       L.addAccount(1234, new Account(1234, 20));
       L.addAccount(6778, new Account(6778, 10));

       // Create a new journal, J.
       Journal J = new Journal();

       // Transactions consist of an account reference, an amount
       // and in this assignment, transactions also have a string describing
       // the transaction.
       // Each transaction is added to the journal.
       J.addTransaction(new Transaction(1234, 20, "deposit on 3/9/2011"));
       J.addTransaction(new Transaction(6778, 10, "deposit on 4/9/2011"));
       J.addTransaction(new Transaction(6778, -50, "withdrawal on 6/9/2011"));

       // Transactions must contain a "process" method that is called to
       // actually perform the transaction.
       // A journal also has its own process method that calls the transaction process
       // method for each transaction, in the order that the transaction was created.
       J.process(L);

       // For each account in the ledger, print the opening balance, list all the
       // transactions for that account and print the closing balance.
       // This method is provided for you in the Ledger class.
       L.report();
    }
}

You can download a skeleton project here. You should write methods that conform to the specifications here. This is a zip file containing the documentation of a “standard” solution. When you unzip the ass2_doc.zip file, open index.html and you will be able to browse through all the classes and methods. You must implement all of the methods as specified, except the report and toString methods, which have already been provided.

FAQ

  1. What is the format of the output?
    We have provided you with all of the report methods. You should print no additional output.
  2. Is the Unique Account Identifier (key) for the ledger hashmap the same as the account number?
    Yes

Submission instructions

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

  1. From within your assignment 2 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 “assignment2.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 “assignment2” from the next drop down menu and press “Upload my Assignment”
  9. Accept the student declaration
  10. Press “Choose File” and select the “assignment2.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.