Loan Calculator Sample

This sample is located in \Samples\afc11\LoanCalc.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

This sample shows how an applet or application can accept input from a wizard and return a complex result. The sample uses a wizard for entering loan parameters. The wizard validates the loan parameters entered at every step before proceeding to the next step. When the data entered is invalid, a message box appears that indicates the error. When the wizard finishes, a column viewer appears that shows the payment schedule for the loan. The loan parameters appear to the left of the column viewer. The parameters displayed in black (Interest Rate and Payment Frequency) must have a value (that is, they cannot be calculated). The remaining parameters appear in either blue (indicating the parameter was entered) or in red (indicating that the parameter was calculated).

Using the Sample

To use the sample

  1. When the applet starts, the wizard automatically appears and displays a welcome message. Click Next to proceed.

  2. Enter the amount of the loan and click Next.

  3. Enter the interest rate for the loan (or use the arrows to select a rate from the list). Click Next.

  4. Optionally, enter the length of the loan in months or years. Then, select a payment frequency period and click Next.

  5. If you specified the length of the loan in step 4, the wizard displays a message that it is ready to calculate the payment schedule. Click Finish.

  6. If you did not specify the length of the loan in step 4, the wizard next prompts you to enter a loan payment amount. Enter the amount and click Next. The wizard displays a message that it is ready to calculate the payment schedule. Click Finish.

You can use the Back and Next buttons at any time to move forward and back through the wizard. Click the Modify Parameters button to invoke the wizard, enter new parameters, and recalculate the payment schedule.

Key Project Files

LCWizard.java

This class extends UIWizard and implements LCConsts. Its getNextStep method validates loan parameters entered in the wizard.

LCCtrlPnl.java

This class extends UIPanel and implements LCConsts, LCCallbacks, and Runnable. It sets default loan parameters, and creates the Loan Parameters display, the payment schedule display, and the wizard. It also contains methods that set and get wizard input and handle errors in that input.

LCParams.java

This class implements LCConsts. It does the various calculations by combining wizard input with the constants.

Technologies Demonstrated

AFC

© 1999 Microsoft Corporation. All rights reserved. Terms of use.