home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR22
/
JORF21_2.ZIP
/
PAYMENT.J
< prev
next >
Wrap
Text File
|
1993-07-05
|
2KB
|
55 lines
Class:Payment (Amt,Yrs,Intr,Pmt,Pmt50,Yrs50)
Payment:Start
New (Payment:Pmt)
Win:Add ("Loan Payment Calculator",5,20)
String:"Calculate your loan payment amount and years"
String:"to pay if you added just $50 to the payment."
String:
String:"Press the TAB key to get from one field to"
String:"the next. ENTER will end the program."
Input:"&Loan Amount ", Row:7 Col:5 Wid:14
Field:"Pmt->Amt", After:"Payment:Calc(Pmt)"
Format:"###,###,###.00", Type:"Numeric"
Input:"&Years to Pay ", Row:8 Col:5 Wid:3
Field:"Pmt->Yrs", After:"Payment:Calc(Pmt)"
Format:"###", Type:"Numeric"
Input:"&Percent Interest ", Row:9 Col:5 Wid:8
Field:"Pmt->Intr", After:"Payment:Calc(Pmt)"
Format:"#0.0000%", Type:"Numeric"
Input:"Payment ", Row:10 Col:5 Wid:14
Field:"Pmt->Pmt", Before:"Return(Null)"
Format:"###,###,###.00", Type:"Numeric"
Input:"Adding just $50 ", Row:12 Col:5 Wid:14
Field:"Pmt->Pmt50", Before:"Return(Null)"
Format:"###,###,###.00", Type:"Numeric"
Input:"Reduces the years to" Row:13 Col:5 Wid:3
Field:"Pmt->Yrs50", Before:"Return(Null)"
Format:"###", Type:"Numeric"
Button:" &Done ", Row:15, Col:16
Return(Ok)
Payment:Calc(Pmt)
New (Periods,Per_Intr,Payment,Months50)
Pmt->Pmt = 0
If (Pmt->Intr > 0 And Pmt->Yrs > 0)
Periods = Pmt->Yrs*12
Per_Intr = Pmt->Intr/12/100
Payment = (Pmt->Amt*Per_Intr) / (1-Num:Pow(1+Per_Intr,(-Periods)))
Payment = Num:Int((Payment+.005)*100)/100
Pmt->Pmt = Payment
Pmt->Pmt50 = Payment+50
Months50 = Num:Log(Pmt->Pmt50/(Pmt->Pmt50-Pmt->Amt*Per_Intr))
Months50 = Months50/Num:Log(1+Per_Intr)
Pmt->Yrs50 = Num:Int((Months50/12)*10)/10
Win:Dsp
Return (Ok)