The Profit Scoop 2021: TOOLS

www.theprofitscoop.com

Java Calculators

Generated Code

<form name="myform">
<table width="210" border="1" cellspacing="1" cellpadding="1" bgcolor="#003366">
<tr>
<td align="center">
<table width="173" border="0" cellspacing="0" cellpadding="0" height="130">
<tr>

</tr>
<tr>
<td colspan="3">
<input type="text" name="display" size="20">

</td>
<td width="53" height="0"> <font color="#FFFFFF">
<input type="button" name="clear" value=" c "
onClick="myform.display.value=''" onMouseover="window.status='Clear numbers'" onMouseout="window.status=''">
</font></td>
</tr>
<tr>
<td width="53" height="0">
<input type="button" name="seven" value=" 7 "
onClick="myform.display.value+='7'">
</td>
<td width="53" height="0">
<input type="button" name="eight" value=" 8 "
onClick="myform.display.value+='8'">

</td>
<td width="53" height="0">
<input type="button" name="nine" value=" 9 "
onClick="myform.display.value+='9'">
</td>
<td width="53" height="0"> <font color="#FFFFFF">
<input type="button" name="divide" value=" / "
onClick="myform.display.value+='/'">
</font></td>
</tr>
<tr>
<td width="53" height="0">
<input type="button" name="four" value=" 4 "
onClick="myform.display.value+='4'">

</td>
<td width="53" height="0">
<input type="button" name="five" value=" 5 "
onClick="myform.display.value+='5'">
</td>
<td width="53" height="0">
<input type="button" name="six" value=" 6 "
onClick="myform.display.value+='6'">
</td>
<td width="53" height="0"> <font color="#FFFFFF">
<input type="button" name="times" value=" x "
onClick="myform.display.value+='*'">
</font></td>

</tr>
<tr>
<td width="53" height="0">
<input type="button" name="one" value=" 1 "
onClick="myform.display.value +='1'">
</td>
<td width="53" height="0">
<input type="button" name="two" value=" 2 "
onClick="myform.display.value +='2'">
</td>
<td width="54" height="0">
<input type="button" name="three" value=" 3 "
onClick="myform.display.value +='3'">
</td>
<td width="72" height="0"> <font color="#FFFFFF">
<input type="button" name="minus" value=" - "
onClick="myform.display.value+='-'">
</font></td>
</tr>
<tr>
<td width="53" height="0">
<input type="button" name="zero" value=" 0 "
onClick="myform.display.value+='0'">
</td>
<td width="53" height="0"> </td>

<td width="54" height="0">
<input type="button" name="plus" value=" + "
onClick="myform.display.value +='+'">
</td>
<td width="72" height="0"> <font color="#FFFFFF">
<input type="button" name="calculate" value=" = "
onClick="myform.display.value=eval(myform.display.value)">
</font></td>
</tr>
</table>
</td>

</tr>
</table>
</form>

Generated Code

<script type="text/javascript">
function addChar(input, character) { if(input.value == null || input.value == "0") input.value = character else input.value += character } function cos(form) { form.display.value = Math.cos(form.display.value) } function sin(form) { form.display.value = Math.sin(form.display.value); } function tan(form) { form.display.value = Math.tan(form.display.value); } function sqrt(form) { form.display.value = Math.sqrt(form.display.value); } function ln(form) { form.display.value = Math.log(form.display.value); } function exp(form) { form.display.value = Math.exp(form.display.value); } function sqrt(form) { form.display.value = Math.sqrt(form.display.value); } function deleteChar(input) { input.value = input.value.substring(0, input.value.length - 1) } function changeSign(input) { if(input.value.substring(0, 1) == "-") input.value = input.value.substring(1, input.value.length) else input.value = "-" + input.value } function compute(form) { form.display.value = eval(form.display.value); } function square(form) { form.display.value = eval(form.display.value) * eval(form.display.value); } function checkNum(str) { for (var i = 0; i < str.length; i++) { var ch = str.substring(i, i+1) if (ch < "0" || ch >
"9") { if (ch != "/" && ch != "*" && ch != "+" && ch != "-" && ch != "." && ch != "(" && ch!= ")") { alert("invalid entry!"); return false; } } } return true; } </script>
<center>
<form>
<input name="display" value="0" size=25>
<br>
<input type="button" value=" exp " onClick="if (checkNum(this.form.display.value)) { exp(this.form) }">
<input type="button" value=" 7 " onClick="addChar(this.form.display, '7')">
<input type="button" value=" 8 " onClick="addChar(this.form.display, '8')">
<input type="button" value=" 9 " onClick="addChar(this.form.display, '9')">
<input type="button" value=" / " onClick="addChar(this.form.display, '/')">
<br>
<input type="button" value=" ln " onClick="if (checkNum(this.form.display.value)) { ln(this.form) }">
<input type="button" value=" 4 " onClick="addChar(this.form.display, '4')">
<input type="button" value=" 5 " onClick="addChar(this.form.display, '5')">
<input type="button" value=" 6 " onClick="addChar(this.form.display, '6')">
<input type="button" value=" * " onClick="addChar(this.form.display, '*')">
<br>
<input type="button" value=" sqrt " onClick="if (checkNum(this.form.display.value)) { sqrt(this.form) }">
<input type="button" value=" 1 " onClick="addChar(this.form.display, '1')">
<input type="button" value=" 2 " onClick="addChar(this.form.display, '2')">
<input type="button" value=" 3 " onClick="addChar(this.form.display, '3')">
<input type="button" value=" - " onClick="addChar(this.form.display, '-')">
<br>
<input type="button" value=" sq " onClick="if (checkNum(this.form.display.value)) { square(this.form) }">
<input type="button" value=" 0 " onClick="addChar(this.form.display, '0')">
<input type="button" value=" . " onClick="addChar(this.form.display, '.')">
<input type="button" value=" +/- " onClick="changeSign(this.form.display)">
<input type="button" value=" + " onClick="addChar(this.form.display, '+')">
<br>
<input type="button" value=" ( " onClick="addChar(this.form.display, '(')">
<input type="button" value=" cos " onClick="if (checkNum(this.form.display.value)) { cos(this.form) }">
<input type="button" value=" sin " onClick="if (checkNum(this.form.display.value)) { sin(this.form) }">
<input type="button" value=" tan " onClick="if (checkNum(this.form.display.value)) { tan(this.form) }">
<input type="button" value=" ) " onClick="addChar(this.form.display, ')')">
<br>
<input type="button" value=" Clear " onClick="this.form.display.value = 0 ">
<input type="button" value=" Back Space " onClick="deleteChar(this.form.display)">
<input type="button" value=" Enter " name="enter" onClick="if (checkNum(this.form.display.value)) { compute(this.form) }">
</FORM>

Generated Code

<script type="text/javascript">
function fmtPrice(value) {
result="$"+Math.floor(value)+".";
var cents=100*(value-Math.floor(value))+0.5;
result += Math.floor(cents/10);
result += Math.floor(cents%10);
return result;
}

function compute() {
var unformatted_tax = (document.forms[0].cost.value)*(document.forms[0].tax.value);
document.forms[0].unformatted_tax.value=unformatted_tax;
var formatted_tax = fmtPrice(unformatted_tax);
document.forms[0].formatted_tax.value=formatted_tax;
var cost3= eval( document.forms[0].cost.value );
cost3 += eval( (document.forms[0].cost.value)*(document.forms[0].tax.value) );
var total_cost = fmtPrice(cost3);
document.forms[0].total_cost.value=total_cost;
}

function resetIt() {
document.forms[0].cost.value="19.95";
document.forms[0].tax.value=".06";
document.forms[0].unformatted_tax.value="";
document.forms[0].formatted_tax.value="";
document.forms[0].total_cost.value="";
}
</script>

<CENTER>
<FORM>
<TABLE BORDER=2 WIDTH=300 CELLPADDING=3>
<TR>
<TD align="center">
<FONT SIZE=+1>
<STRONG>
Cost</STRONG>
</FONT>
<TD align="center">
<FONT SIZE=+1>
<STRONG>
Tax</STRONG>
</FONT>
</TR>
<TR>
<TD align="center">
<INPUT TYPE="text" NAME="cost" VALUE="19.95" SIZE=10>
<TD align="center">
<INPUT TYPE="text" NAME="tax" VALUE=".06" SIZE=10>
</TR>
</TABLE>
<BR>
<TABLE BORDER=1 WIDTH=600 CELLPADDING=3>
<TR>
<TD align="center">
<FONT SIZE=+1>
<STRONG>
Unformatted Tax</STRONG>
</FONT>
<TD align="center">
<FONT SIZE=+1>
<STRONG>
Formatted Tax</STRONG>
</FONT>
<TD align="center">
<FONT SIZE=+1>
<STRONG>
TOTAL COST</STRONG>
</FONT>
</TR>
<TR>
<TD align="center">
<INPUT TYPE="text" NAME="unformatted_tax" SIZE=15>
<TD align="center">
<INPUT TYPE="text" NAME="formatted_tax" SIZE=15>
<TD align="center">
<INPUT TYPE="text" NAME="total_cost" SIZE=15>
</TR>
</TABLE>
<BR>
<TABLE BORDER=0 WIDTH=400 CELLPADDING=5>
<TR>
<TD align="center">
<INPUT TYPE="reset" VALUE="RESET" onClick="resetIt()">
<TD align="center">
<INPUT TYPE="button" VALUE="COMPUTE" onclick="compute()">
</TR>
</TABLE>
</CENTER>