<%@ LANGUAGE = JScript %> Future Value Calculation <% // Check to see if an Annual Percentage Rate // was entered var rate = Request("APR")(1); if (rate.substring(0,1) == "." ) rate = "0" + rate; var v = IsNumeric(rate); if (v == true) { if (rate > 1) { var APR = rate / 100; } else var APR = rate; } else var APR = 0; // Check whether a value for Total Payments // was entered var totpmnt = Request("TotPmts")(1); var tp = IsNumeric(totpmnt); if (tp == true) { var TotPmts = totpmnt; } else var TotPmts = 0; // Check whether a value for Payment Amount // was entered var pymnt = Request("Payment")(1); var ts = IsNumeric(pymnt); if (ts == true) { var Payment = pymnt; } else var Payment = 0; // Check whether a value for Account Present Value // was entered var payval = Request("PVal")(1); var tx = IsNumeric(payval); if (tx== true) { var PVal = payval; } else var PVal = 0; //Check whether user wants to make payments at the beginning or end of month. var ptype = Request("PayType")(1); if (ptype == "Beginning") { var PayType = 1; } else var PayType = 0; // Create an instance of the Finance object Finance = Server.CreateObject("MS.Finance.Java"); //Use your instance of the Finance object to // calculate the future value of the submitted // savings plan using the HTML form and the // CalcFV method FVal = Finance.CalcFV(APR / 12, TotPmts, -Payment, -PVal, PayType) var Savings = NumFormat(FVal); //Function for determining if form value is a number. function IsNumeric(str) { for (var i=0; i < str.length; i++){ var ch = str.substring(i, i+1) if( ch < "0" || ch>"9" || str.length == null){ return false; } } return true; } //Function for limiting return values to two places after decimal point. function NumFormat(str) { str = "" + str + "00"; return (str.substring (0, str.indexOf (".") + 3)); } %>

Your savings will be worth $ <%= Savings%>.