Home Financial Calculator
Patrick Parrish, Programming Supervisor
Many home budget programs have been published in magazines, but rarely has there been a program integrating as wide a variety of loan and investment calculations as "Home Financial Calculator." It is versatile, easy to use, and flexible. Rapid recalculation features make it an ideal tool for "what if" projections. A calculator mode with memory lets you solve problems not directly supported by the program, and you can pass values generated by one calculation to another. It works on the Commodore 64; VIC-20 (with at least 8K memory expansion); Commodore Plus/4 and 16 (using the 64 version); Commodore PET; Atari 400/800 (with at least 16K for tape and 24K for disk) and XL/XE models; Apple II series; IBM PC and PCjr; and TI-99/4A (regular BASIC). Though not tested on other computers, the program is written generally enough to run with trivial modifications on any computer with Microsoft BASIC.
Investment and loan calculations are readily computerized. In fact, many programs have been written which perform these tasks individually. "Home Financial Calculator" goes a step further by integrating several common financial calculations in a menu-driven package. It also features a calculator mode or scratch pad area where program variables can be manipulated using common mathematical operations.
Program 1 is a general BASIC program that runs without modification on Apple II-series computers, and also on a number of other machines with minor changes. No matter what computer you have, type in Program 1. For computers other than the Commodore models you should type a caret (ˆ) for the character shown as an up-arrow (&arrow;). Then add the appropriate lines for your computer from Programs 2–7. As always, save the program before running it for the first time.
Important: Because Program 1 is a general listing for several different computers, it has no checksum numbers for use with the "Automatic Proofreader." Be extra careful when typing this program, especially the long lines which contain the financial formulas. A mistyped program may still run, but the results it gives could be inaccurate.
When you run the program, a main menu offers you a choice of Investment or Loan calculations. Type I or L to reach the appropriate submenu.
Before looking at any calculations, let's consider some basics of the program. Home Financial Calculator uses some parameters or variables repeatedly in the calculations. These variables are Total (also referred to as Future Value, Total Owed, etc., depending on the calculation); Present Value (principal); Interest Rate; Years; Months; Number of Periods (of either compounding, deposits, withdrawals, or payments, depending on the application); Deposits; and Withdrawals. When in the calculator mode (explained below), you'll reference these eight variables with the single letters T, P, I, Y, M, N, D, and W.
As you work with Home Financial Calculator, the values of the eight variables are preserved until you change them. Whenever the program asks you for an input (for example, Interest), the current value of that variable is displayed (zero if no value has been entered yet). If you want to keep the current value, just press RETURN (or ENTER, depending on your keyboard). Otherwise, enter the new value and press RETURN.
With this feature, Home Financial Calculator makes it easy for you to generate "what if" projections. Simply run the same calculation repeatedly, each time changing a previously entered value. Press RETURN to keep a value, and change only one or two values to see the effect on the final result.
You can also store the current value into the calculator mode's Memory Register or recall a value from the Memory Register. To see how all this works, let's take a look at some calculations possible with Home Financial Calculator.
Here is the Investment submenu that appears when you type I from the main menu:
- Future Value with Periodic Interest
- Future Value with Interest Compounded Continuously
- Future Value with Regular Deposits
- Future Value with Cash Flows
- Withdrawal of Funds
- Net Present Value
- Calculator Mode
- Return to Main Menu.
Determine which option you want and press the appropriate key.
Each option displays screen prompts which ask you to input several values. These values are stored in the eight variables mentioned above: T for Total (Future Value), P for Present Value (principal), I for Interest Rate, Y for Years, M for Months, N for Number of Periods, D for Deposits, and W for Withdrawals. Of course, not all calculations require you to enter all these values, while others may ask for additional information.
Most calculations can be solved for any one of the variables. To solve for a variable, enter an uppercase X at the corresponding input prompt. For example, you could enter values for everything except the Interest Rate, typing X at the Interest Rate prompt. Home Financial Calculator then solves for the Interest Rate.
Remember, however, that the program can solve for only one variable during each calculation. If you enter an X at more than one prompt, the program does not have enough information to calculate an answer. Keep this in mind, because the program does not check for potential conflicts.
Future Value With Periodic Interest
Home Financial Calculator's options are fairly self-explanatory when you run the program, but let's try an example. We'll calculate the future value of an investment drawing periodic interest. This kind of investment could be a savings account, interest-bearing checking account, bonds, or a money market account. Choose this option by entering 1 at the Investment submenu.
After the screen clears, the program asks for the first input—Future Value, which appears with an asterisk (*). Below this is a zero (the current value of this variable in memory; all variables start out with a value of zero). Following this is an input prompt.
The asterisk preceding Future Value means that this is one of the variables you can solve for. (A variable not preceded by an asterisk means that variable cannot be solved for in that particular calculation, so X would be an illegal response.) If you'd like to calculate the Future Value, enter an X here, and answer all the other prompts with the appropriate values.
Let's calculate the future value of a $1,000 investment drawing 8 percent interest for two years and three months, with four compounding periods each year. Enter an X for Future Value, since we'll be solving for this total. Answer Present Value with 1000 (the principal you're investing); Annual Int Rate (%) with 8 (enter the percentage, not a fraction); For # Of Years with 2; For # Of Months with 3; and # Of Periods (Compounding) with 4. After you enter the last value, Home Financial Calculator figures the Total Future Value and displays the answer—$1195.09.
Now suppose you wish to know the future value of the same $1,000 investment if you make 9 percent interest. Choose option 1 on the Investment submenu again and rerun the calculation. Notice how Home Financial Calculator automatically prints the current value of each variable at each prompt. The Future Value prompt shows a current value of 1195.09 from the previous calculation. Type an X at this prompt, 9 for Interest Rate, and RETURN at all other prompts to preserve their values. The result should be $1221.71.
The versatility of Home Financial Calculator becomes apparent when you realize how many different ways you can run this calculation. Using this same menu option, you can calculate the initial investment (or present value) necessary to accrue a certain future value with periodic interest; the interest rate necessary to accrue a future value from a present value; or the time (in years and months) it would take to accumulate a future amount from an initial investment with periodic interest payments. Just enter an X for the unknown value you're seeking, and fill in all the other prompts.
Future Value With Interest Compounded Continuously
Option 2, a variation of option 1, handles investments paying a continuous interest rate. Like option 1, option 2 can handle a number of calculations—just place an X in the slot you'd like to solve for.
Here, after entering all other parameters, you can calculate the future value of an investment; the initial investment required to reach a certain future value; the interest required to reach a desired future value; or the time required to reach a certain future value at a specified interest rate.
Notice that any variables used in option 1 will be displayed with their current values when running option 2. As mentioned above, the eight major variables in Home Financial Calculator retain their values throughout the program until you change them. This feature is convenient when going from one option to another on the Investment or Loan submenus.
In addition, the values are preserved for use in the calculator mode. For instance, you could compare the effect of continuously compounded interest to periodic interest (option 1) without having to retype the input.
Future Value With Regular Deposits
If you're interested in setting up an annuity, you'd choose option 3 on the Investment submenu. You can determine the future value of an account (such as a savings account, Individual Retirement Account, college or vacation fund, etc.) with regular deposits where interest is compounded with each deposit.
Option 3 can also tell you the amount of each deposit necessary to accrue a future value; the interest rate needed to provide some future value with regular deposits; or the time it would take to amass a future value with regular deposits.
Future Value With Cash Flows
Option 4 does a single calculation—it always solves for Future Value, so don't enter an X anywhere. It calculates the future value of an investment with yearly cash flows (either positive or negative). The Annual Interest Rate you input here is the growth rate on the money you've invested.
As an example, suppose you wish to determine the value of a vacation fund collected over four years. You're asked for the number of years, then for the deposit or withdrawal each year. You deposit $500 in the fund the first year and $200 the second. The third year you are forced to withdraw $300 (entered as—300), and the fourth year, you put in $400. The fund has a growth rate of 12 percent. Its value after four years will be $1,017.34.
A future value determination can also tell you whether an investment is worthwhile. If the future value of all cash flows is positive or zero, the investment is profitable. A negative future value, on the other hand, represents a losing investment.
Withdrawal Of Funds
If you intend to open an account from which you can regularly withdraw funds, choose option 5. With this option, you can determine the initial deposit required in the account to cover your withdrawals; the amount you can withdraw regularly from this account; the rate of interest you must make on funds in the account; or the period of time over which you can make withdrawals.
Net Present Value
Option 6 lets you determine the feasibility of a prospective investment by calculating its net present value. Net present value is the current value of all future yearly cash flows to an investment along with any initial cash requirement. The interest rate you input here is the rate of return you require on your investment. A positive net present value indicates a profitable investment, while a negative result signifies a losing investment.
As an example, suppose you have the opportunity to make a $2,000 investment which would return $1,500 the first year, cost you $750 the second year, and return $1,900 the third year. You hope to make 13 percent on your money. With option 6, you determine a net present value of $56.87, representing a profitable investment.
The Calculator Mode
Option 7 puts you in the calculator mode (also available from the Loan submenu). Calculator mode works very much like a handheld calculator with a single memory. You can type in a value or recall one from a variable by entering its symbol—T(otal), P(resent Value), I(nterest Rate), Y(ears), M(onths), N(umber of Periods), D(eposits), and W(ithdrawals). You can perform simple math on values stored in the Memory Register using reverse Polish notation. And you can use the results in future calculations.
When you enter calculator mode, the calculator command line appears on the screen:
V S H R M+ M- M* M/ MR MC MEM-0
Here are the commands:
V (View the values of the eight primary variables)
S (Store Memory Register into a variable)
H (Help—prints the command line)
R (Return to main menu, exit calculator mode
M+ (Add the last input to the Memory Register
M- (Subtract the last input from the value in the Memory Register, and store the result in the Register)
M* (Multiply the last input times the value in the Memory Register, and store the result in the Register)
M/ (Divide the last input into the value in the Memory Register, and store the result in the Register)
MR (Memory Recall)
MC (Memory Clear to Zero)
MEM= (Memory Register's current value)
If you've run through a sample investment calculation, you now have some variables in memory. Enter V in the calculator mode to see them. The screen displays the eight values currently in memory for the eight variables.
To work with one of these variables, enter one of their letters (T, P, I, Y, M, N, D, or W) and press RETURN. Then type M+ to add it to the Memory Register (all variables must be stored in the Register before you can perform any operations on them). Suppose you put the current value for T into the Register and now wish to add $229 to this value. Enter 229, press RETURN, then type M+ and press RETURN. The addition is performed and the result displayed. To store this value back into the T variable, enter S for Store. A prompt appears, requesting the variable in which you intend to store the value. Type T to store the value into the variable T.
You can also use the Memory Register to hold a value not represented by any of the eight variables. To do this, determine a value using the calculator mode and store it into the Memory Register with M +. Then, when you're running a calculation elsewhere in the program, you can substitute this value for any of the eight primary variables by typing MR (Memory Recall) at the appropriate prompt. MR can be used both in the calculator mode and at any prompt where the previous value is displayed.
Finally, option 8 on the Investment submenu returns you to the main menu. Once there, you can perform some loan calculations by typing L.
Here is the Loan calculations submenu:
- Regular Loan Payments
- Remaining Loan Liability
- Final Loan Payment
- Single Payment Loan
- Loan Amortization Schedule
- Calculator Mode
- Return to Main Menu
Regular Loan Payments
Option 1 handles a number of calculations for equal payment loans. You can figure the principal of a loan; the amount of each regular payment necessary to repay a loan; the annual interest rate on a loan with regular payments; or the term of the loan.
Remaining Loan Liability
With option 2, you can determine the remaining balance on a loan with regular payments after a number of payments have been made. Enter the principal on the loan, the amount of each payment, the annual interest rate, the number of payments yearly, and the last payment number.
Final Loan Payment
Option 3 calculates the amount of the final payment on a loan. In many cases, the last payment of a loan will vary from the amount of the regular payment. This option handles situations where the final payment is greater than ("balloon payments") or less than the regular payment.
Single Payment Loan
Option 4 calculates the amount owed on a loan that is paid off with a single payment. You must input the principal on the loan, its annual interest rate, its term in years and months, and the number of times a year the interest on the principal is compounded.
Loan Amortization Schedule
Option 5 displays a loan amortization schedule. Enter the principal on the loan, the amount of each payment, the annual interest rate, the term of the loan, and the number of payments yearly. Then enter the period of the year in which the loan began (for instance, 10 for October) and the range in years of the amortization schedule you'd like to examine.
Because of the complexity of these calculations, there may be a delay before the output appears on the screen, especially if you have chosen to look at the latter years in a longterm loan repayment schedule (such as a home mortgage). When the amortization table appears, it displays the payment number, the beginning balance for the period, the amount paid toward the loan principal, the amount paid in interest, and the ending balance. To keep the information from scrolling off the screen, the program shows only a few payment periods at a time. Press RETURN to view another screenful. When the end of a year is reached, the program gives the total amounts paid on the principal and in interest for the year. In addition, when the last period of the loan is reached, the program displays the final payment for the loan.
The last two options on the Loan submenu are the same as those on the Investment submenu.
Modifying The Program
Home Financial Calculator is written in a modular format for easy modification. For many routines, it uses common input labels (lines 4710–5080) and some output labels (lines 5090–5170). If you want to add an investment or loan calculation routine, choose the labels from these lines that fit your application.
Also, you may wish to add a printer option to the loan amortization schedule. Examine lines 3230–3940. Here, variable D5 (defined in line 150) determines the number of loan payments considered on each screen. Variables S1, S2, S3, and S4 (defined in lines 160–190) format the output horizontally on the screen.