home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
500
/
481
/
balrem.bas
< prev
next >
Wrap
BASIC Source File
|
1986-08-08
|
1KB
|
28 lines
100 'Balance Remaining and Interest Paid ("BALREM")
110 CLS
120 COLOR 0,15 : PRINT "Balance Remaining" : COLOR 15,0
130 PRINT
140 MONEYFMT$ = "$$##,###,###.##"
150 DEFDBL A-Z
160 DEFINT M-N
170 ' Define function to find balance
180 DEF FNBALANCE (N) = ( ( (1+PR) ^ -N -1) * PMT / PR + PNCPL) * (1 + PR) ^ N
190 ' Let user enter data
200 INPUT "Amount of loan: ", PNCPL
210 INPUT "Monthly payment: ", PMT
220 INPUT "Annual interest rate (in percent): ", AR
230 INPUT "Payment number at start of term: ", NSTART
240 INPUT "Payment number at end of term: ", NEND
250 ' Find balance due at both times
260 PR = AR / 1200
270 IF PR <> 0 THEN SBALANCE = FNBALANCE (NSTART) ELSE SBALANCE = PNCPL - NSTART * PMT
280 IF PR <> 0 THEN EBALANCE = FNBALANCE (NEND) ELSE EBALANCE = PNCPL - NEND * PMT
290 ' Find interest paid
300 TOTALINTEREST = (NEND - NSTART) * PMT + EBALANCE - SBALANCE
310 ' Print results
320 PRINT:PRINT
330 PRINT "Initial balance:" TAB(20); USING MONEYFMT$; SBALANCE
340 PRINT "Final balance:" TAB(20); USING MONEYFMT$; EBALANCE
350 PRINT "Interest paid:" TAB(20); USING MONEYFMT$; TOTALINTEREST
360 END