1 Replies - 3419 Views - Last Post: 06 November 2009 - 07:04 AM

#1 BasementArtScott  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 49
  • Joined: 11-July 09

Gross Pay Calculator

Posted 05 November 2009 - 12:12 PM

I have been working on this assignment for a few days, and am close to wrapping it up the only problem I seem to be having is I cannot get my first user prompt to show up under the 3 employee input areas. I can see hours worked, and the 3 totals, however, I cannot see the prompt for entering the rate of pay. Can anyone advise me on what is wrong with my code?

Thank,
Scott

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'
  'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'>

<html xmlns='http://www.w3.org/1999/xhtml'>

  <head>

	<title>

	  Wagemaker

	</title>

	<script type = "text/javascript">

function figureEmpPay() {
var hours = document.forms[0].hours.value;
var regWage = document.forms[0].regWage.value;
if (hours > 40)
  {
  var regTotal = Math.round(regWage * 40);
  var overTotal = Math.round((hours - 40) * (regWage * 1.5));
  }
else
  {
  overTotal = Math.round(hours * 0);
  regTotal = Math.round(hours * regWage);
  }

var total = Math.round(regWage + overPay);

document.forms[0].regTotal.value = regTotal.toLocaleString();
document.forms[0].overTotal.value = overTotal.toLocaleString();
document.forms[0].total.value = total.toLocaleString();

var hours2 = document.forms[1].hours2.value;
var regWage2 = document.forms[1].regWage2.value;
if (hours2 > 40)
  {
  var regTotal2 = Math.round(regWage2 * 40);
  var overTotal2 = Math.round((hours2 - 40) * (wage2 * 1.5));
  }
else
  {
  overPay2 = Math.round(hours2 * 0);
  regTotal2 = Math.round(hours2 * regWage2);
  }

var total2 = Math.round(regTotal2 + overTotal2);

document.forms[1].regTotal2.value = regTotal2.toLocaleString();
document.forms[1].overTotal.value = overTotal2.toLocaleString();
document.forms[1].total2.value = total2.toLocaleString();

var hours3 = document.forms[2].hours3.value;
var regWage3 = document.forms[2].regWage3.value;
if (hours3 > 40)
  {
  var regTotal3 = Math.round(regWage3 * 40);
  var overTotal3 = Math.round((hours3 - 40) * (regWage3 * 1.5));
  }
else
  {
  overTotal = Math.round(hours3 * 0);
  regTotal = Math.round(hours3 * regWage3);
  }

var total3 = Math.round(reg_pay3 + overTotal3);

document.forms[2].regTotal3.value = regTotal3.toLocaleString();
document.forms[2].overTotal3.value = overTotal3.toLocaleString();
document.forms[2].total3.value = total3.toLocaleString();


}
</head>
</script>



<body>

<h1>Employee #1</h1>

<form action = “”>

<p>

<label>

<input type = “text” id = "regWage”/> Enter Your Pay Rate

</label>

<br /><br />




<p>

<label>

<input type = “text” id = "hours”/> Enter Your Hours Worked

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "regTotal” readonly= "readonly"/> Regular Pay Amount

</label>

<br /><br />


<p>

<label>

<input type = “text” id = "overTotal” readonly= "readonly"/> Overtime Pay Amount

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "Total1” readonly= "readonly"/> Total Pay

</label>

<br /><br />

<h1>Employee #2</h1>

<form action = “”>

<p>

<label>

<input type = “text” id = "regWage2”/> Enter Your Hourly Pay Rate

</label>

<br /><br />


<p>

<label>

<input type = “text” id = "hours2”/> Enter Your Hours Worked

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "regTotal2” readonly= "readonly"/> Regular Pay Amount

</label>

<br /><br />


<p>

<label>

<input type = “text” id = "overTotal2” readonly= "readonly"/> Overtime

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "Total2” readonly= "readonly"/> Total Pay

</label>

<br /><br />
<h1>Employee #3</h1>

<form action = “”>

<p>

<label>

<input type = “text” id = "regWage3”/> Enter Your Hourly Rate

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "hours3”/> Enter Your Hours Worked

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "RegTotal3” readonly= "readonly"/> Regular Pay Amount

</label>

<br /><br />



<p>

<label>

<input type = “text” id = "OverTotal3” readonly= "readonly"/> Overtime

</label>

<br /><br />

<p>

<label>

<input type = “text” id = "Total3” readonly= "readonly"/> Total Pay

</label>

<br /><br />
</body>

</html>



Is This A Good Question/Topic? 0
  • +

Replies To: Gross Pay Calculator

#2 touch  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 23
  • Joined: 20-October 09

Re: Gross Pay Calculator

Posted 06 November 2009 - 07:04 AM

I put the code onto my compuer and I can see hourly rate. However, and I could be wrong here but it appears that you have some mismatched quotation marks around some items. ie:

 "regTotal”


should have matching quotes like

"regTotal"



Try that and see if it works
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1