function NPVHelp(form) {	alert("This feature is not yet implemented.");}function randomNPVProblem(form) { 	theCF0 = -1000 - (Math.round(Math.random()*2)*100);  	theCF1 = ((Math.round(Math.random()*5)) + 1)*100; 	theCF2 = ((Math.round(Math.random()*5)) + 1)*100;  	theCF3 = ((Math.round(Math.random()*5)) + 1)*100;  	theCF4 = ((Math.round(Math.random()*5)) + 1)*100;  	theCF5 = ((Math.round(Math.random()*5)) + 1)*100; 	theRate = ((Math.round(Math.random()*1500)) + 100)/100; 	form.Year0.value="" + theCF0; 	form.Year1.value="" + theCF1; 	form.Year2.value="" + theCF2; 	form.Year3.value="" + theCF3; 	form.Year4.value="" + theCF4; 	form.Year5.value="" + theCF5; 	form.RateInput.value="" + theRate; 	form.NPVOutput.value=""; }  function findNPV(form) { 	theCF0Str = form.Year0.value; 	if (!isNegativeNumber(theCF0Str)) { 		return false; 	} 	theCF1Str = form.Year1.value; 	if (!isPositiveNumber(theCF1Str)) { 		return false; 	} 	theCF2Str = form.Year2.value; 	if (!isPositiveNumber(theCF2Str)) { 		return false; 	} 	theCF3Str = form.Year3.value; 	if (!isPositiveNumber(theCF3Str)) { 		return false; 	} 	theCF4Str = form.Year4.value; 	if (!isPositiveNumber(theCF4Str)) { 		return false; 	} 	theCF5Str = form.Year5.value; 	if (!isPositiveNumber(theCF5Str)) { 		return false; 	} 	theRateStr = form.RateInput.value; 	if (!isPositiveNumber(theRateStr)) { 		return false; 	} 	theCF0 = parseFloat(theCF0Str); 	theCF1 = parseFloat(theCF1Str); 	theCF2 = parseFloat(theCF2Str); 	theCF3 = parseFloat(theCF3Str); 	theCF4 = parseFloat(theCF4Str); 	theCF5 = parseFloat(theCF5Str); 	theRate = parseFloat(theRateStr); 	var theNPV = theCF0; 	theNPV += theCF1/(1 + theRate/100); 	theNPV += theCF2/Math.pow(1 + theRate/100,2); 	theNPV += theCF3/Math.pow(1 + theRate/100,3); 	theNPV += theCF4/Math.pow(1 + theRate/100,4); 	theNPV += theCF5/Math.pow(1 + theRate/100,5); 	form.NPVOutput.value = "" + Math.round(theNPV*100)/100; 	return true; }  function calcNPVHelp(form) { 	theCF0Str = form.Year0.value; 	if (!isNegativeNumber(theCF0Str)) { 		return false; 	} 	theCF1Str = form.Year1.value; 	if (!isPositiveNumber(theCF1Str)) { 		return false; 	} 	theCF2Str = form.Year2.value; 	if (!isPositiveNumber(theCF2Str)) { 		return false; 	} 	theCF3Str = form.Year3.value; 	if (!isPositiveNumber(theCF3Str)) { 		return false; 	} 	theCF4Str = form.Year4.value; 	if (!isPositiveNumber(theCF4Str)) { 		return false; 	} 	theCF5Str = form.Year5.value; 	if (!isPositiveNumber(theCF5Str)) { 		return false; 	} 	theRateStr = form.RateInput.value; 	if (!isPositiveNumber(theRateStr)) { 		return false; 	} 	theCF = new Array(6); 	theCF2 = new Array(6); 	theF = new Array(6); 	theCF[0] = parseFloat(theCF0Str); 	theCF[1] = parseFloat(theCF1Str); 	theCF[2] = parseFloat(theCF2Str); 	theCF[3] = parseFloat(theCF3Str); 	theCF[4] = parseFloat(theCF4Str); 	theCF[5] = parseFloat(theCF5Str); 	theRate = parseFloat(theRateStr); 	var theNPV = theCF[0]; 	var theNum = 0; 	var theCNT = 1; 	for (i = 1; i <= 5; i++) {	 	theNPV += theCF[i]/Math.pow(1 + theRate/100,i);	 	if (i > 1) {	 		if (theCF[i] == theCF[i-1]) {	 			theCF2[theCNT] = theCF[i];	 			theF[theCNT]++;	 		} else {	 			theCNT++;	 			theCF2[theCNT] = theCF[i];	 			theF[theCNT] = 1;	 		}	 	} else {	 		theCF2[theCNT] = theCF[i];	 		theF[theCNT] = 1;	 	} 	} 	theNPV = "" + Math.round(theNPV*100)/100; 	var theOut = "<html><head><title>NPV Help</title></head><body bgcolor='white'>"; 	theOut += "<h3>NPV Help</h3>"; 	theOut += "<p>To solve using the Texas Instruments BA II Plus Calculator:</p>"; 	theOut += "<table><tr align='center'><td>[CF]</td><td>[2nd][CLR WORK]</td></tr>"; 	theOut +="<tr align='center'><td>" + theCF[0] + "</td><td>[Enter][Down Arrow]</td></tr>"; 	for (i=1; i<=theCNT; i++) {	 	theOut +="<tr align='center'><td>" + theCF2[i] + "</td><td>[Enter][Down Arrow]</td></tr>";	 	theOut +="<tr align='center'><td>" + theF[i] + "</td><td>[Enter][Down Arrow]</td></tr>"; 	} 	theOut +="<tr align='center'><td>[NPV]</td><td>&nbsp;</td></tr>"; 	theOut +="<tr align='center'><td>" + theRateStr + "</td><td>[CPT]</td></tr></table>"; 	theOut += "<p><b>The NPV is $" + theNPV + "</b></p>"; 	theOut += "<CENTER>";	theOut += "<P><FORM NAME=\"Form1\">";	theOut += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></P></CENTER>"; 	theOut += "</body></html>"; 	var newWin = window.open("","","scrollbars,resizable,width=400,height=420"); 	if (newWin != null) { 		newWin.document.write(theOut); 		newWin.document.close(); 		newWin.focus(); 	} 	return true; }  function isPositiveNumber(inputStr) { 	for (var i = 0; i < inputStr.length; i++) { 		var oneChar = inputStr.substring(i,i+1); 		if (((oneChar >= "0") && (oneChar <= "9")) || (oneChar == ".")) { 		 		} else { 			alert("Please make sure that only numbers are input."); 			return false; 		}  	}	return true; }  function isNegativeNumber(inputStr) { 	if (inputStr.length < 2) { 		alert("Please input a negative number."); 		return false; 	} 	var oneChar = inputStr.substring(0,1); 	if (oneChar != '-') { 		alert("Please make sure that only negative numbers are input."); 		return false; 	} 	for (var i = 1; i < inputStr.length; i++) { 		oneChar = inputStr.substring(i,i+1); 		if (((oneChar >= "0") && (oneChar <= "9")) || (oneChar == ".")) { 		 		} else { 			alert("Please make sure that only numbers are input."); 			return false; 		}  	}	return true; }