January 2004
Intermediate to advanced
368 pages
7h 25m
English
In addition to temperature conversion, another common calculation for your users might well deal with estimating the size of loan payments. This script helps answer the question, "What can I do with that bonus?" — at least when things are going well.
While the formula to calculate payments based on the principal, interest rate, and duration of the loan is a bit tricky, some judicious use of shell variables tames the beast and makes it surprisingly understandable too.
#!/bin/sh # loancalc - Given a principal loan amount, interest rate, and # duration of loan (years), calculates the per-payment amount. # Formula is: M = P * ( J / (1 - (1 + J) ** -N)) # where P = principal, J = monthly interest rate, N ...
Read now
Unlock full access