|
|
|
Section 4: Programming 2 72
|
|
Programming Label D : Months for Savings to Overtake Downpayment
|
|
Instead of calculating monthly a sequence like before, the task here is to calculate a specific
answer—the month at which sayings are great enough to permit purchase of the house. We will
set up a counter for the number of months in R8 and use a logical test (x > y, i.e.,
downpayment > savings) to decide if we should continue for another month or if the increased
savings has overtaken the required downpayment.
|
|
1.
|
Switch to W/PRGM. Do not press f  PRGM .
|
|
2.
|
See 84, the code for R/S . Since R/S was not the last instruction in LBL C ,
press SST , see 22, the code for GTO .
|
|
3.
|
Now press SST , see 00, the code for 0 . You are now at the end of the previous
segment of the program and are ready to key in the sequence below.
|
|
|
KEY ENTRY
|
CODE SHOWN
|
COMMENTS
|
LBL
|
23
|
|
D
|
14
|
|
RCL 1
|
34 01
|
|
STO 2
|
33 02
|
Reset savings and
|
RCL 4
|
34 04
|
dnpmt
|
STO 5
|
33 05
|
|
0
|
00
|
Start month zero
|
STO 8
|
33 08
|
|
LBL
|
23
|
|
1
|
01
|
Return point
|
1
|
01
|
|
STO
|
33
|
Add one to month
|
+
|
61
|
counter
|
8
|
08
|
|
B
|
12
|
Calculate savings
|
A
|
11
|
Calculate dnpmt
|
g x>y
|
35 24
|
If savings less
|
GTO
|
22
|
than dnpmt return
|
1
|
01
|
to LBL 1, otherwise
|
RCL 8
|
34 08
|
recall month
|
RTN
|
24
|
|
|
|
|
|
|
|