How do you limit the number of digits that are displayed when outputting a number using Java. FOr example instead of 23.032345434 I want to display 23.03.
I'm trying to limit the digits shown on my little calculator at www.GasCreditCard.biz.
19 NP to whoever answers my question correctly first. That means that the answer directly has to lead to my problem being fixed.
I'm trying to limit the digits shown on my little calculator at www.GasCreditCard.biz.
19 NP to whoever answers my question correctly first. That means that the answer directly has to lead to my problem being fixed.
Code:
function calculatesavings(form)
{
MPG = form.MPG.value;
MDPY = form.MDPY.value;
PPG = form.PPG.value;
GTS = form.GTS.value;
G=MDPY/MPG;
CWS=G*PPG;
SPY=CWS*.1;
SPM=SPY/12;
SPG=.1*PPG;
SPT=SPG*GTS;
form.SPY.value=SPY;
form.SPM.value=SPM;
form.SPT.value=SPT;
form.SPG.value=SPG;
}
</script>
Last edited:







