CMPT370 Lab0: Template Lab Write-up

The project directory for this sample lab (including code, Fluid file, and Windows executable) are here. A tarball or ZIP of this whole directory are what should be submitted to eCourses.

Approximate lab marking weights:

Purpose of the Program:

Compute the amount there will be in my bank account after one year if the interest is compounded quarterly and any withdrawals I make are entered immediately after the interest is paid.

Suitability:

The bank account example given above is well within the reach of a simple calculator, and is therefore of somewhat marginal suitability for computer solution. However, the solution does illustrate how the problem-solving process works, from problem statement to design to implementation.

Problem Restatement:

Libraries:

This program uses FLTK for the graphical user interface; any 1.x version should work. This program should work anywhere FLTK works.

Problem Refinement (natural language pseudocode):

  1. Input Section:
  2. Computation:
  3. Output:

Second Refinement (natural language pseudocode):

  1. Input (BankInterestUI Fluid file):
  2. Computation (BankInterest core logic):
  3. Output (BankInterestUI Fluid file):

Program Design:

This simple GUI program has several input widgets and one output widget for the final balance. All the input widgets have the same callback: update_balance(). This callback just does the interface between the GUI widgets and the C function which does all the number-crunching.

The core logic is in BankInterest.cxx, which just has one function: calc_balance(). This takes a starting balance, an interest rate (percent), and an array of four widthdrawal amounts. It returns the final balance amount.

Data Table:

BankInterestUI (Fluid GUI):

BankInterest (core logic):

User Manual:

Description:

Bank Interest is a small application designed to maintain a simple bank account record. It allows the user to specify the opening balance, and annual interest rate at the beginning of the program, and then to make quarterly withdrawals. Interest is calculated on the balance before the withdrawal.

Operation:

There are six input boxes in the main window: At the bottom of the window you will see the final balance in the account at the end of the year. It will automatically update each time you change a value in the input boxes.

To quit the program, select the "Ok, bye!" button, or press Esc.

Test Cases, with expected results:

Normal Test case:

Test case with negative balance:

Bugs / Limitations

The program is quite limited in only allowing four widthdrawals, at a fixed compounding interval of once a quarter. Potential extensions could allow for arbitrary compounding intervals, and perhaps a more flexible way of specifying when widthdrawals happen.

Screenshots


(Can be embedded here or left as separate files if you like, but list the filenames here.)