Hatch Your Nest Egg

See all articles from SYNC v4 n1

The best part about money is spending it. The worst part is that eventually the money runs out. Calculating how long the money will last can be time consuming and tedious. How frustrating it is to complete a lengthy set of calculations covering a 20 year period, only to discover that you forgot to take into account a car purchase in year 14, or that you made a mistake in year 3, or that you now wish you had used a different interest rate in your calculations.

A colleague of mine who will retire soon wanted to know what kind of income he could anticipate during his retirement years. He asked me if I had a formula to calculate how long the money would last if he received 7% interest on his severance pay and withdrew $300 a month.

I did not have a simple formula, but I thought immediately of my Sinclair and decided to write a program to let the computer do the work.

Program Features

Estimating future income and expenditures is difficult because of the large number of factors that must be considered such as: initial capital amount, new additions of capital, interest rates, interest accumulation, and monthly withdrawals.

Initial Capital

You begin using the program by entering a lump sum amount of capital, e.g., your existing savings, a bond coming due, you equity from the sale of a property, your annual savings from a raise in salary, an estimate of your inheritance, or simply your dream of your lottery winnings. Any amount of initial capital may be used.

New Capital

You may then choose: 1) to add new capital in lump sum amounts during any 5 years, 2) not to add new capital, or 3) to add capital in only 1 or 2 years, up to a maximum of 5 years. You can select any year, e.g. number 4, number 13, and number 17.

Interest Rates

The program then offers you a choice of holding the interest rate constant or of varying the interest rate. The rate may be your own estimate, or be based on information from newspapers, trade magazines, your banker, or an investment advisory service.

1) Constant Interest

If you feel that no one can predict interest rates or that, with inflation moderating, the interest rates will not be as volatile as in the last decade, you may choose the present interest rate (or a more moderate one) and hold that rate constant for all the years of the calculations.

2) Varying Interest

If you have faith in professionals’ ability to predict financial matters or feel that interest rate volatility will continue, you will probably choose to vary the interest rate assumptions. If you choose the varying interest rate option, the program recognizes that near term predictions will be more accurate than longer term predictions. This recognition requires changing the number of years for which a given interest rate will apply.

Since a fairly good estimate of interest rates may be possible for the first year, the program asks you to specify one interest rate for the first year. Predictions then become difficult. The program asks you to specify an interest rate for the next 2 years, and a third for the following 3 years. To this point, interest rates have been selected for the first 6 years. Accurate prediction beyond that point is virtually impossible. Thus, the program asks you to select a fourth interest rate for all remaining years of the calculations, probably a moderate rate reflecting normal economic times.

Interest Accumulation

The next choice in the program is whether or not to leave the capital alone for a number of years to collect interest before you begin withdrawing money. For example, if you have an annuity or a savings plan for your children’s education, you will probably not withdraw money for a certain number of years. The capital amount will then grow at the rate you previously determined, according to your selection of interest rates and the additions of new capital.

On the other hand, if you intend to begin withdrawing money immediately from your capital, you would not select this option.

Withdrawal Rates

The final choice of the program is either a constant or a varying monthly withdrawal rate.

If you are relatively certain about your intended withdrawals and of the stability of the economic environment, then you would probably choose a constant withdrawal rate.

If you believe that inflation will continue, or if you estimate that your withdrawal needs will change over the years (for example, because of your living expenses going up or down), then you would select the option to vary the withdrawal rates.

The program assumes that your prediction of your financial needs will probably be more accurate in the near term than in the long term. Thus, you are asked to select one monthly withdrawal rate for the first 2 years, another for the next 3 years, a third for the following 5 years, and a fourth for all remaining years.

Regardless of whether you select a constant or varying withdrawal rate, the withdrawals are not introduced into the calculations until after the years of interest accumulation without withdrawals have ended.

Program Output

At this point, your inputs are finished. The program will first display a summary of your selected options and inputs and then print the years and the amount of capital left until all the capital is gone.

Thus, you will see how many years the money will last under your set of assumptions. If the results are not satisfactory in terms of meeting your financial objectives, you can change the items and try the calculations again.

Examples

The following three examples demonstrate the flexibility of “Nest Egg.” I recommend that you use the FAST mode when running this program.

1) Retirement

Upon retirement, many people receive a lump sum payment of severance benefits. Suppose that you retire at age 63 and receive $10,000. Because of a pension, you will not need to withdraw money immediately; so you decide to leave the capital alone for 4 years to collect interest. At age 71, you decide to sell your house and move to an apartment. Thus, you will have both an influx of capital and an increase in monthly living expenditures.

LOAD or ENTER the program in Listing 1. Press RUN and ENTER to start. First, the program will ask you to enter the initial capital. Enter 10,000. When the computer asks if you wish to add new capital, answer yes, and, upon prompting for the number of such years, enter 1. The computer asks you to enter the year number and the amount of new capital. Since at the age of 71 you would be at year number 8 of the program calculations (which began at your age of 63), enter 8 and then enter the capital amount (e.g., 60,000 for the house sale).

Then select interest rates. If you believe rates will change over the years, answer yes to the computer’s questioning if you wish to vary the rates. The computer will then ask for the interest rate for the first year (enter 8), the next 2 years (7), the next 3 years (6.5), and all remaining years (4).

You are then asked if you wish to leave the capital alone to collect interest for a number of years. In this case, you answer yes, and upon prompting for the number of years, enter 4.

Now you are asked to decide if your withdrawals will vary over the years. Since you are changing accommodations, answer yes. Perhaps you also wish to increase the rate of withdrawals to cover inflation. Remember that you retired at age 63 and let interest accumulate for 4 years until age 67. At age 71, you will see an increase in expenses as you move to an apartment.

After estimating your monthly financial needs, enter upon prompts a withdrawal rate of 150 per month for the first 2 years (i.e., to age 69), 200 per month in the next 3 years (i.e., to age 72), 600 per month in the next 5 years (i.e., to age 77), and 700 per month in all remaining years. The dramatic increase in the third withdrawal rate is to take into account the increased accommodation expenses.

As soon as you enter the last figure, the program prepares and displays the following summary of your inputs:

At this point, you can review the inputs to see if you wish to change any assumption when you run the program again.

Press CONT and ENTER, and the program will begin the calculations. When the display reappears after about 10 seconds, it will show 20 years of calculations. Note that the amount of capital increases to $13167 at the end of year 4, reflecting the 4 years of interest accumulation you selected. The capital left then decreases to $9264 at the end of year 7 because the withdrawals began in year 5. In year 8, the capital increases to $69634 as the house sale was included at the beginning of the year. The next year, the capital increases again to $70019, because interest income was slightly larger than withdrawals. But the next year, the capital decreases as the withdrawal rate changes from $200 monthly to $600 monthly (i.e. year 10 is year number 6 of monthly withdrawals). For the five years of $600 monthly withdrawals, the capital declines significantly from $70019 in year 9 to $46188 in year 14. From that point, monthly withdrawals of $700 produce a more rapid decline to $2722 in year 20. Press CONT and ENTER.

When the display reappears, it shows the last year of calculation, year 21, with capital left of $5570. This last figure means that after 21 years, you would be $5570 in debt, or that your Nest Egg would be gone in between 20 and 21 years. Thus, with this set of assumptions, you would exhaust your money at about age 83 or 84.

Given a realistic life expectancy, that situation is probably acceptable. If it does not seem quite enough, then you may wish to rerun the calculations, changing the amounts of initial and new capital, and the years of interest accumulation without withdrawals.

If you wish to test new assumptions, simply enter yes when asked by the program if you wish to do so.

2) Saving Plan for Children’s Education

Say upon the birth of a child, you put $500 aside as the start of an educational savings plan. Say you add an additional $500 per year for the next 5 years, and then let the money collect interest until the child is 18. Suppose the child, as a university student, will need to withdraw the money at a rate of $250 per month to help cover educational costs (presumably in addition to other sources of income.)

Upon prompting, enter 500 as the initial capital, and yes, there will be years of new capital being introduced. Enter 5 to answer how many years, and, upon prompting, enter 2 as the year and 500 as the amount and so on, up to and including year 6. If you wish to make a conservative estimate of interest rates, answer no, you do not wish to vary them. “Nest Egg” will then ask you what constant interest rate you wish to use for all years. Say you enter 5. Enter yes when asked if the capital will be left alone to collect interest, and enter 18 as the number of years, when prompted.

Since you have determined to withdraw money at a constant rate, answer no to the question of varying the withdrawal rate. When the program asks you for a constant withdrawal rate, enter 250.

Upon the 1st entry, the program will assemble and then display a summary of your inputs. They should look like this:

Because the most simple option was selected, there is also enough room on the screen for the first 3 years of calculations. Press CONT and ENTER.

Oops! With these assumptions, if the student begins to withdraw money at the start of year 19, he will run out after a little more than 2 years. If you intend the Nest Egg to last for, say, a three year university course, then you will have to change some of your inputs, such as the amount of initial capital or the amount of capital additions.

3) Perpetual Charitable Bequests

Suppose your goal is to make your name live forever by making charitable donations to your favorite cause in perpetuity, based on an initial amount of money that you will bequeath to a trust fund. In order for the donations to be made forever, the annual donations and expenses (or withdrawals) must not exceed the annual income (or interest in this case). Therefore, if you know how much interest will be generated in any year, you automatically know the maximum withdrawal rate for that year.

First, you must estimate the original size of the endowment to the trust fund. Say you intend to bequeath $10,000. When prompted for the initial capital, you would enter 10000. Since you will no longer be around after the initial donation, you answer no to the question of adding more capital in later years. Presumably, you would be doing this estate planning for some future time, several years away. Consequently, you could not possibly make accurate interest rate projections. Therefore, you would probably use a historically average interest of, say, 3%. You would enter no when asked if you wish to vary the interest rate, and 3 when asked for the constant rate.

Since the purpose of the program in this example is to estimate income, you will not be making withdrawal calculations. Therefore, there is no point to using the option of leaving the capital alone to collect interest, without withdrawals. You would enter no when prompted about using this option.

Again, since you will be making no withdrawals, you would enter no, when asked if you would like to vary the withdrawal rate, and enter 0 when asked what constant withdrawal rate you wish to use.

The program will then summarize your inputs, do the calculations, and print the results. But be careful: since there are no withdrawals in the calculations, the calculations would continue until you run out of memory.

From the figures presented, you will be able to determine the income in any year by subtracting the capital left in the year in question, from the capital left in the following year. This income equals the maximum amount that could be given away during that year minus expenses. For example the capital left after year 10 is $13,434, and after year 11 is $13,837. Therefore, during year 10, you could begin perpetual withdrawals of $13,837-$13,434, or $403.

If you began the withdrawals in year 10, the capital would remain a constant $13,434, because you would be withdrawing the exact amount of interest paid.

In this way, “Nest Egg” can be used to determine how long you would have to let the capital collect interest before disbursements of a given size were made from the trust fund.

Teaching Value Of The Program

Although “Nest Egg” is flexible and directly applicable to several different situations, its true value is what it can teach about programming the Sinclair to solve everyday problems. The main points to be learned are summarized below.

Use of GOTO and GOSUB for Calculations

In spite of a potential 250 different combinations of variables in the program, there is only one formula line: 1240. This approach is possible because in principle, “Nest Egg” does only one set of tasks: it calculates the result of adding income and subtracting withdrawals.

The complication is that there are several definitions of both income and withdrawals. For example, there is only one interest variable in the formula (Q), but there are potentially 5 different interest rates, or 5 definitions of Q.

In order for the correct definitions of the variable to be selected (e.g., the correct interest rate), it is necessary to initialize 26 variables (lines 2 to 27), use three GOSUBs (lines 1180, 1210, and 1220), use three lines to interchange variables under specified conditions (lines 1190, 1200, and 1230) as well as use a conditional loop (line 1270).

Initializing the variables is required because all variables must be present in the program even if they are not used in the calculations. If a variable has not been initialized by the program or input by the user when running the program, the computer will print an error message and end the running of the program.

The three GOSUBs set the conditions for changing the value of the variables in the formula line. For example, Q in line 1240 represents the interest rate. GOSUB 3000 changes Q to F, G, H, and I, depending on the year number, and thus introduces varying interest rates into the single line formula. These three GOSUBs are supported by lines 1190, 1200, and 1230 which change the formula variables under conditions not covered by the GOSUBs.

Changing Year Values

The “Nest Egg” faces a problem in telling the computer what year it is from the point of view of each variable. For example, you chose varying interest rates, 3 years of capital accumulation, and varying withdrawal rates. Year 6 of the program would be year 6 for interest rates, year 3 for withdrawals and no year at all for interest accumulations without withdrawals.

The problem is to make each year equal to the actual year of the calculations. In this example, the formula must use the first year of withdrawals in year number 4 (i.e., after 3 years of interest accumulation without withdrawals). Thus, the computer must be made to see withdrawal year number 1 as year number 4.

This problem was resolved by three methods. In the above example, GOSUB 3500 defines the year as the year of the withdrawal plus the total years of interest accumulation without withdrawals. Thus in the above example, the year number would be 1 (of withdrawals) +3 (of interest accummulation), or year number 4. This approach was used because of the possibility of expressing the relationship between these variables mathematically.

A second method was used for the years of capital additions because no mathematical relationship is possible since any 5 years could be selected with this option. Each of the 5 years was assigned a separate variable value. When the actual year value equals this specific variable value, then the computer seeks the related new capital to add to the existing capital. This process is carried out in GOSUB 2500.

A third method was used for years of interest accumulation without withdrawals, because this option posed yet another problem. The years of this variable are the same as the years of calculations, except that at a predetermined point, the years of interest accumulation cease. Thus, line 1200 removes any reference to this option once the related calculations have been completed. It does so by making the formula withdrawal variable (E) equal to 0, only if it is a year of interest accumulation without withdrawals.

User Friendly

“Nest Egg” is user friendly to the point that separate documentation is not required for its operation. Documentation would be required, however, to fully express the flexibility of the program, and its various applications.

“Nest Egg” takes the user step by step through the selection of options and input of data. A table summarizing the selection of options and inputs is displayed, prior to the actual calculations. The results of the calculations are displayed along with a year number for ease of reference. Finally, the user is given the option of changing the inputs by running the program again. Throughout the program, the only inputs required from the user are numerical inputs and the words “yes” and “no”. This user friendliness, however, is memory consuming.

[Figure: Cartoon. Two men watch a frazzled player at a “STRESS” arcade machine: “They never should have come out with this game!”]

Modifications To Expand The Program

You can modify the program to increase its capacity to meet all possible circumstances posed by the user.

The most obvious change is to increase the number of choices within the three variables of 1) new years of capital additions by continuing the WA and XA series of variables beyond the existing 5 to the number desired; 2) varying interest rates, by adding more interest rates, or by changing the number of years during which the rates pertain; and 3) varying withdrawal rates, by adding more rates, or by changing the number of years during which the rates pertain.

Such changes would require further changes in the subroutines that govern access to the formula line. The latter two changes are not recommended because the degree of accuracy in predicting future interest rates or financial needs, is not sufficient to justify rewriting the program or to ask the user for additional inputs.

The first possible expansion could be handled a better way. The more years that are allowed for new capital additions, the more the option resembles a saving feature. So why not add one?

A saving option could be modelled partly on the new capital addition lines and partly on the withdrawal lines. Since the user will not have both net withdrawals and net savings in the same years, the only time that net savings can occur is before the withdrawals begin. A similar condition has already been created with the option of collecting interest without withdrawals in the first years of the calculations.

The task, then, would be to 1) ask for the year numbers and the monthly savings rates (this input could be user-proofed by having the program reject years that exceeded the last year of interest accumulation without withdrawals), 2) assign variable numbers in a similar way to new capital additions inputs, 3) add the savings to the formula calculations in a similar way to the selection of varying withdrawal rates, 4) have a subroutine to change the value of E in the formula to a minus saving rate (E.g., if the savings rate were $200 per month, the subroutine would change E to -200 giving the expression -12*-200, or +2400. In this way, the formula variable intended to represent a withdrawal, in fact becomes a savings.)

This latter approach can be used to modify the original intent of “Nest Egg” without necessarily changing the actual programming. If fewer than 5 years of new capital addition are used, the remaining number of years can be used to add monthly savings. For example, if you have no years of new capital lump sums, but have 5 years of monthly savings, simply multiply the monthly savings by 12 to obtain an annual rate, and enter the data as if it represented lump sum capital additions.

Again if you do not use all 5 years for capital additions, you can use the remaining years for lump sum withdrawals. For example, you can introduce the purchase of a new car into the calculations (say in year number 8) by selecting the new capital additions option, and then entering 8 (the year number) and -9000 (the car cost). The minus sign in front of the car price will require the program to treat the entry as a withdrawal, in spite the options original intent of making additions.

Changes made to the actual programming also would require changes in the lines summarizing the user’s inputs.

Line Notes:

2-17: Initialize main variables.

40-50: Input initial capital.

80-530: Make decision on adding new capital; input new capital additions. Each year has a different variable name (WA to WE) related to the capital amount (XA to XE). After each year’s input, the program checks to see if that is the last input to be expected by comparing variable W (number of years of new capital additions) to the variable S (the number of years input so far).

550-690: Make decision on varying interest rates; input rates.

710-760: Make decision on accumulating interest without withdrawals; input number of such years.

780-930: Make decision on varying the withdrawal rates; input the rates.

950-1130: Display a summary of the options and inputs. Note that the printing of any line is governed by a conditional statement which defines whether user has selected the related option. E.g., lines 1010-1040 are printed only if the variable F is greater than O. Since F is the first of the four varying interest rates, it must be greater than O only if the user selected the option of varying the rates. If the user selected the constant rate, these lines would not be printed.

1180-1230: Introduce the subroutines and conditional statements for selecting the correct variables for inclusion in the calculation formula.

1240: The formula line: A = capital; Q/100 = interest rate, and 12*E = 12 times the monthly withdrawal rate. The subroutines and conditional statements substitute variables within the formula, but do not change the formula itself. Variable A is changed by subroutine 2500; Q by 3000 and the conditional statement in 1230; E by 3500 and the conditional statements in 1190 and 1200.

1250-1270: Print the results of the calculations; return the program to 1180 to calculate the next year; the process continues until the capital is exhausted; i.e., until A is no longer greater than O.

1500-1520: Input the constant interest rate; program goes to the line following the last varying interest rate line.

2000-2020: Input constant withdrawal rate; program goes to line following the last varying withdrawal rate line.

2500-2560: Select amounts of new capital to be added to the initial capital depending on the year number; change the value of the related variable A in formula line 1240.

3000-3540: Select any of four withdrawal rates depending on the year number and the number of years (J) allowed for interest to accumulate without withdrawals. Thus LET Y = J + 1 means, in effect, that, if the year of the calculation equals the number of years without withdrawals plus 1, you should use the withdrawal rate applicable in year 1. This process changes the value of the related variable E in line 1240.

[Figure: Screen display: summary of inputs (initial capital $10000, some new capital in 5 years, a varying interest rate of 15%, 12%, 7% and 5%, interest growth for the first 5 years, and constant monthly withdrawals of $400)]

[Figure: Screen display: YEAR 1 to YEAR 15 with CAPITAL LEFT, ending $-2593, and the prompt THAT ENDS THE CALCULATIONS WOULD YOU LIKE TO CHANGE ANY OF YOUR ESTIMATES?]

[Figure: Screen displays of the program’s withdrawal and interest rate prompts]

Listing 1.

   1 REM "NEST EGG"
2 LET C=0
3 LET D=0
4 LET E=0
5 LET F=0
6 LET G=0
7 LET H=0
8 LET I=0
9 LET J=0
10 LET K=0
11 LET L=0
12 LET M=0
13 LET N=0
14 LET S=0
15 LET W=0
16 LET X=0
17 LET Y=1
18 LET WA=0
19 LET WB=0
20 LET WC=0
21 LET WD=0
22 LET WE=0
23 LET XA=0
24 LET XB=0
25 LET XC=0
26 LET XD=0
27 LET XE=0
30 CLS
40 PRINT "ENTER INITIAL AMOUNT OF CAPITAL"
50 INPUT A
60 CLS
70 LET B$="YES"
80 PRINT "WILL THERE BE ANY YEARS IN WHICHYOU INTRODUCE NEW CAPITAL?"
90 INPUT B$
100 IF B$<>"YES" THEN GOTO 540
110 CLS
120 PRINT "HOW MANY YEARS WILL SEE NEW ADDITIONS OF CAPITAL? (YOU HAVE A MAXIMUM CHOICE OF 5 YEARS)"
130 INPUT W
140 CLS
150 PRINT "FIRST ENTER THE YEAR NUMBER AT THE BEGINNING OF WHICH YOU WILL ADD NEW CAPITAL, AND THEN ENTER THE AMOUNT OF NEW CAPITAL."
160 INPUT WA
170 INPUT XA
180 CLS
190 LET S=S+1
200 IF S=W THEN GOTO 550
210 PRINT "YEAR ";WA;" NEW CAPITAL $";XA
220 PRINT
230 PRINT
240 PRINT "ENTER THE NEXT YEAR NUMBER AT THE BEGINNING OF WHICH YOU WILL ADD NEW CAPITAL, AND THEN ENTER THE AMOUNT OF NEW CAPITAL."
250 INPUT WB
260 INPUT XB
270 CLS
280 LET S=S+1
290 IF S=W THEN GOTO 550
300 PRINT "YEAR ";WB;" NEW CAPITAL $";XB
310 PRINT
320 PRINT
330 PRINT "ENTER THE NEXT YEAR AND THEN ENTER THE NEW CAPITAL."
340 INPUT WC
350 INPUT XC
360 CLS
370 LET S=S+1
380 IF S=W THEN GOTO 550
390 PRINT "YEAR ";WC;" NEW CAPITAL $";XC
400 PRINT
420 PRINT "ENTER THE NEXT YEAR AND THEN ENTER THE NEW CAPITAL."
430 INPUT WD
440 INPUT XD
450 CLS
460 LET S=S+1
470 IF S=W THEN GOTO 550
480 PRINT "YEAR ";WD;" NEW CAPITAL $";XD
490 PRINT
500 PRINT
510 PRINT "ENTER THE NEXT YEAR AND THEN ENTER THE NEW CAPITAL."
520 INPUT WE
530 INPUT XE
540 CLS
550 PRINT "DO YOU WISH TO VARY THE INTERESTRATE OVER THE YEARS?"
560 INPUT B$
570 CLS
580 IF B$<>"YES" THEN GOTO 1500
590 PRINT "WHAT INTEREST RATE DO YOU WANT FOR THE FIRST YEAR?"
600 INPUT F
610 PRINT
620 PRINT "WHAT INTEREST RATE FOR THE NEXT 2 YEARS?"
630 INPUT G
640 PRINT
650 PRINT "AND FOR THE SUBSEQUENT 3 YEARS?"
660 INPUT H
670 PRINT
680 PRINT "FINALLY, WHAT SINGLE INTEREST RATE FOR ALL REMAINING YEARS?"
690 INPUT I
700 CLS
710 PRINT "DO YOU WISH TO ACCUMULATE INTEREST FOR A NUMBER OF YEARS BEFORE YOU BEGIN TO WITHDRAW MONEY?"
720 INPUT B$
730 CLS
740 IF B$<>"YES" THEN GOTO 780
750 PRINT "HOW MANY YEARS DO YOU WISH TO ACCUMULATE INTEREST WITHOUT WITHDRAWLS?"
760 INPUT J
770 CLS
780 PRINT "DO YOU WISH TO VARY THE RATE OF WITHDRAWLS OVER THE YEARS?"
790 INPUT B$
800 CLS
810 IF B$<>"YES" THEN GOTO 2000
820 CLS
830 PRINT "HOW MUCH WILL YOU WITHDRAW MONTHLY IN THE FIRST 2 YEARS?"
840 PRINT
850 INPUT K
860 PRINT "HOW MUCH MONTHLY IN THE NEXT 3 YEARS?"
870 INPUT L
880 PRINT
890 PRINT "AND MONTHLY IN THE NEXT 5 YEARS?"
900 INPUT M
910 PRINT
920 PRINT "AND FINALLY, MONTHLY FOR ALL REMAINING YEARS?"
930 INPUT N
940 CLS
950 PRINT " BASED ON AN INITIAL CAPITAL OF$";A
960 PRINT
970 IF W>0 THEN PRINT " SOME NEW CAPITAL IN"
980 IF W>0 THEN PRINT W;" YEARS"
990 PRINT
1000 IF C>0 THEN PRINT " A CONSTANT INTEREST RATE OF ";C;"[graphic]/[graphic]"
1010 IF F>0 THEN PRINT " A VARYING INTEREST RATE OF ";F;"[graphic]/[graphic] IN THE FIRST YEAR"
1020 IF F>0 THEN PRINT G;"[graphic]/[graphic] IN THE NEXT TWO YEARS"
1030 IF F>0 THEN PRINT H;"[graphic]/[graphic] IN THE NEXT THREE YEARS"
1040 IF F>0 THEN PRINT I;"[graphic]/[graphic] FOR REMAINING YEARS"
1050 PRINT
1060 IF J>0 THEN PRINT " INTEREST GROWTH FOR THE FIRST ";J;" YEARS"
1070 PRINT
1080 IF K>0 THEN PRINT " AND VARYING WITHDRAWLS OF $";K;" MONTHLY FOR TWO YEARS"
1090 IF K>0 THEN PRINT "$";L;" MONTHLY FOR THREE YEARS"
1100 IF K>0 THEN PRINT "$";M;" MONTHLY FOR FIVE YEARS"
1110 IF K>0 THEN PRINT "$";N;" MONTHLY FOR OTHER YEARS"
1120 IF K=0 THEN PRINT " AND CONSTANT MONTHLY WITHDRAWLS OF"
1130 IF K=0 THEN PRINT "$";D
1140 PRINT
1150 PRINT
1160 PRINT
1170 PRINT
1180 IF K>0 THEN GOSUB 3500
1190 IF D>0 THEN LET E=D
1200 IF J>=Y THEN LET E=0
1210 IF W>0 THEN GOSUB 2500
1220 IF F>0 THEN GOSUB 3000
1230 IF C>0 THEN LET Q=C
1240 LET A=INT (A*Q/100+A-12*E)
1250 PRINT "YEAR ";Y;" CAPITAL LEFT $";A
1260 LET Y=Y+1
1270 IF A>0 THEN GOTO 1180
1280 PRINT
1290 PRINT
1300 PRINT
1310 PRINT
1320 PRINT "THAT ENDS THE CALCULATIONS.WOULDYOU LIKE TO CHANGE ANY OF YOUR ESTIMATES?"
1330 INPUT B$
1340 IF B$="YES" THEN GOTO 2
1350 PRINT
1360 PRINT
1370 PRINT "OK. THAT ENDS THE RUNNING OF THEPROGRAM. TRY IT AGAIN IF YOU HAVE MORE QUESTIONS."
1380 STOP
1500 PRINT "WHAT CONSTANT INTEREST RATE WOULD YOU LIKE TO USE?"
1510 INPUT C
1520 GOTO 700
2000 PRINT "WHAT CONSTANT AMOUNT DO YOU WISHTO WITHDRAW EVERY MONTH?"
2010 INPUT D
2020 GOTO 940
2500 IF Y=WA THEN LET X=XA
2510 IF Y=WB THEN LET X=XB
2520 IF Y=WC THEN LET X=XC
2530 IF Y=WD THEN LET X=XD
2540 IF Y=WE THEN LET X=XE
2550 IF Y=WA OR Y=WB OR Y=WC OR Y=WD OR Y=WE THEN LET A=A+X
2560 RETURN
3000 IF Y=1 THEN LET Q=F
3010 IF Y=2 OR Y=3 THEN LET Q=G
3020 IF Y=4 OR Y=5 OR Y=6 THEN LET Q=H
3030 IF Y>6 THEN LET Q=I
3040 RETURN
3500 IF Y=1+J OR Y=2+J THEN LET E=K
3510 IF Y=3+J OR Y=4+J OR Y=5+J THEN LET E=L
3520 IF Y=6+J OR Y=7+J OR Y=8+J OR Y=9+J OR Y=10+J THEN LET E=M
3530 IF Y>10+J THEN LET E=N
3540 RETURN

A copy of “Nest Egg” is available on cassette for $9.95 from the author.

Media

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.