19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

152 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

msg = “Please enter year (1-”& Str(numMs / 12)<br />

msg = msg & “) for which amorization is to be shown:”<br />

startMonth = 12 * Val(InputBox(msg)) - 11 picDisp.Cls<br />

picDisp.Print “”, “Amount Paid “,<br />

picDisp.Print “Amount Paid”, “Balance at”<br />

picDisp.Print “Month”, “for Principal”,<br />

picDisp.Print “for Interest”, “End of Month”<br />

mRate = yearlyRate / 12 ‘monthly rate<br />

monthlyPayment = Payment(prin, mRate, numMs)<br />

totalInterest = 0<br />

yearInterest = 0<br />

oldBalance = prin<br />

For monthNum = 1 To numMs<br />

newBalance = Balance(monthlyPayment, oldBalance, mRate)<br />

principalPaid = oldBalance - newBalance<br />

interestPaid = monthlyPayment - principalPaid<br />

totalInterest = totalInterest + interestPaid<br />

If (monthNum >= startMonth) And (monthNum yearlyRate + .01<br />

End Sub<br />

Private Sub ShowPayment(prin As Single, yearlyRate As Single, numMs As Integer)<br />

Dim mRate As Single, prn As String, apr As String

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!