Answer on Question #54762 - Programming - AJAX | JavaScript | HTML | PHP
Program contents:
function returnFutureValue(p, i, t) {
return p * Math.pow((1 + i), t);
}
for(var c=0; c<5; c++) {
var p = parseInt(Math.floor(Math.random() * 1000) + 1); // get random value of the present value of account
var i = (parseInt(Math.floor(Math.random() * 10))/10); // get random value of the monthly interest rate
var t = parseInt(Math.floor(Math.random() * 100) + 1); // get random the number of months
var f = returnFutureValue(p, i, t);
}
var result = 'Present Value: $' + p.toString() + "\r\n"
+ 'Monthly Interest Rate: ' + i.toString() + "\r\n"
+ 'Number of Months: ' + t + "\r\n"
+ 'Future Value: $' + f.toFixed(2).toString() + "\r\n";
console.log(result); //show results
}http://www.AssignmentExpert.com/
Comments