11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

www.it-ebooks.infoCHAPTER 4 • FUNCTIONS// Payment iteration$paymentNumber = 1;// Determine total number payments$totalPayments = $termLength * $paymentsPerYear;// Determine interest component of periodic payment$intCalc = 1 + $interestRate / $paymentsPerYear;// Determine periodic payment$periodicPayment = $balance * pow($intCalc,$totalPayments) * ($intCalc - 1) /(pow($intCalc,$totalPayments) - 1);// Round periodic payment to two decimals$periodicPayment = round($periodicPayment,2);// Create tableecho "";echo "Payment NumberBalancePaymentPrincipalInterest";// Call recursive functionamortizationTable($paymentNumber, $periodicPayment, $balance,$monthlyInterest);// Close tableecho "";?>Figure 4-1 shows sample output, based on monthly payments made on a five-year fixed loan of$10,000.00 at 5.75 percent interest. For reasons of space conservation, just the first 12 payment iterationsare listed.99

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

Saved successfully!

Ooh no, something went wrong!