Question
decode php to javascript Product Discount Calculator Loan Calculator Loan Amount Interest Rate (annual %) Period in years //Here goes the answer //To ensure form
decode php to javascript
Loan Calculator
if ($loanAmount && $annualRate && $periodInYears) { // Check if these values are valid. //Start to do your work here. Don't use operator '**'. $monthRate = $annualRate / 12 / 100; //Convert years to months(periods) $numberOfPeriods = $periodInYears * 12; //Calculating numerator of the formula i.e A*r $numerator = $loanAmount*$monthRate; //Calculating denominator of the formula i.e (1 - pow((1+r),(-n))) $denominator = (1 - pow((1 + $monthRate), -($numberOfPeriods))); //Calculating Monthly Payment i.e numerator/denominator $payment = $numerator/$denominator; //Calculating Total Interest i.e nP-A $totalInterest = $numberOfPeriods * $payment - $loanAmount;
document.write "Monthly payment is: $payment
"; document.write "Total Interest is: $totalInterest
";
} } //If form not submitted don't show any values else{ document.write "Loan amount:
"; document.write "Annual Rate:
"; document.write "Years in the loan periond:
"; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started