Originally posted by Paul Dixon:
the problem is the line...
the problem is the line...
I'll let you know. Thanks.
------------------
$lib all off color 14,1 do cls f$ = "$###,###.##" locate 5,29 : Print;"Regular payment on a loan" locate 7,25 : Input;"Term in years: ",years if years = 0 then exit loop locate 9,25 : Input;" Principal: ",principal if principal = 0 then exit loop save = principal locate 11,25 : Input;"Interest rate: ",interest if interest = 0 then exit loop monthly = 12 'Monthly payments REM Computer monthly payments te = ((interest / 100) * principal / monthly) / _ (1-1 / ((interest / 100) / monthly + 1) ^ (monthly * years)) payment = int(te * 100 + .5) / 100 [b] REM This is the mod that I came up with in response to Pauls REM response. It seems to work in as far as making the REM months come out exact. te$ = str$(te) p = instr(te$,".") if p = 0 then te$ = te$ + ".000" te = val(mid$(te$,p+3,1)) if te < 5 then payment = payment + .01 [/b] rem t$ = using$(f$,payment) t$ = remove$(t$," ") locate 15,22 : print;"Regular payments: ";t$ locate 17,10 print;"Press ESCape to end the program or any other key to" locate 18,10 print;"write the data to a disk file." if abort = 0 then fi$ = "amort.txt" te$ = dir$(fi$) if te$ <> "" then kill fi$ open fi$ for binary as #1 crlf$ = chr$(13) + chr$(10) separator$ = string$(75,"-") + crlf$ m$ = "Original loan amount: " + using$(f$,principal) + crlf$ m$ = m$ + " Length of loan: " + Str$(years) + " Years" + crlf$ m$ = m$ + " Interest Rate: " + str$(interest) + " Percent" + crlf$ m$ = m$ + crlf$ m$ = m$ + " Monthly Payment: " + using$(f$,payment) m$ = m$ + crlf$ + crlf$ put$ #1,m$ put$ #1,separator$ put$ #1,"Month" + space$(5) put$ #1,"Interest" + space$(5) put$ #1,"Principal" + space$(8) put$ #1,"Balance" + space$(7) put$ #1,"Equity" + space$(5) put$ #1,"Accr Inter" + crlf$ put$ #1,separator$ for month = 1 to monthly * years + 5 REM Calculate interest paid with each payment tointerest = int((principal * (interest / 100) / monthly) * 100 + .5) / 100 REM Add up the accumulated interest accum = accum + tointerest REM How much of the payment goes to principal toprincipl = payment - tointerest REM How much equity is built up equity = equity + toprincipl if equity > save then equity = save REM How much of the principal is left principal = principal - toprincipl REM Zero out a negative number if principal < 0 then principal = 0 t1$ = using$(f$,tointerest) : t1$ = remove$(t1$," ") t2$ = using$(f$,toprincipl) : t2$ = remove$(t2$," ") t3$ = using$(f$,principal) : t3$ = remove$(t3$," ") t4$ = using$(f$,equity) : t4$ = remove$(t4$," ") t5$ = using$(f$,accum) : t5$ = remove$(t5$," ") te$ = space$(2) + using$("###",month) te$ = te$ + space$(13 - len(t1$)) + t1$ for x = len(te$) to 31 - len(t2$) te$ = te$ + " " next x te$ = te$ + t2$ for x = len(te$) to 46 - len(t3$) te$ = te$ + " " next x te$ = te$ + t3$ for x = len(te$) to 59 - len(t4$) te$ = te$ + " " next x te$ = te$ + t4$ for x = len(te$) to 74 - len(t5$) te$ = te$ + " " next x te$ = te$ + t5$ put$ #1,te$ + crlf$ rem print;te$ if principal <= 0 then exit for if month / 12 = int(month / 12) then put$ #1,string$(75,"-") + crlf$ end if next month close #1 m$ = "Finished writing to " + chr$(34) + "AMORT.TXT" + chr$(34) m$ = m$ + " file." col = 40 - int(len(m$) / 2) locate 20,col : print;m$; REM I didn't include an LPRINT routine since a lot of printers REM are of the USB variety. Can't get there from here. m$ = "Bring up your favorite ASCII word processor to print it out." col = 40 - int(len(m$) / 2) locate 21,col print;m$; end if m$ = "Tap ESCape to end or any other key to compute another" col = 40 - int(len(m$) / 2) locate 22,col print;m$ t = abort if t = 1 then exit loop loop end function abort while instat=0:wend an$ = inkey$ if an$ = chr$(27) then function = 1 else function = 0 end if end function
DO UNTIL ABS(lastval# - thisval#) < .00001!
IF Z# < | > |= X# THEN [b]EXIT FOR[/b] ....
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: