Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nprompt = function(prompt)
- print(prompt)
- term.clearLine()
- term.setTextColor(colors.yellow)
- write("> ")
- term.setTextColor(colors.white)
- return tonumber(read())
- end
- local amountFinanced = nprompt("Amount financed?")
- local months = nprompt("Months?")
- local monthlyPayment = nprompt("Monthly payment?")
- local function getFinanceCharge(months, monthlyPayment, amountFinanced)
- local totalPaybackAmount = monthlyPayment * months
- local financeCharge = totalPaybackAmount - amountFinanced
- local financeChargePerHundred = 100 * (financeCharge / amountFinanced)
- return totalPaybackAmount, financeCharge, financeChargePerHundred
- end
- totalPaybackAmount, financeCharge, financeChargePerHundred = getFinanceCharge(months, monthlyPayment, amountFinanced)
- print("Look for '"..tostring(financeChargePerHundred).."'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement