SYMA
03-20-2003, 01:04 PM
hello!
i have the following assignment to do. below is the question and the code from the two files. when i click on "calculate pay" in first file, it opens a page which is showing the asp code. can you pls tell me whats wrong?
the question:
Write a Web application that computes and displays the total pay for an employee. The application should accept regular hours, overtime, and the hourly wage rate for one employee, using an employee timesheet as input. The employee timesheet will be an html form. Be sure to invoke an asp function to calculate the pay.
Be sure you name the text boxes you created so you can call the information from them.
Display the output to an asp page called calculate.asp
In your code you will need to declare variables for regular hours, overtime hours, hourly wage, commission, and total sales.
You should declare the hours as double and the wage variables as currency.
"Use the following for calculating commission: Commission = Sales * .06"
You will need to calculate the total earnings by using the following formula.
(Regular hours * hourly wage) + (overtime hours *(hourly wage *1.5))
Display all this to the screen on calculate.asp with the descriptive text as well.
i am pasting the html code from the 1st one here and am attaching the second file:
<HTML>
<HEAD>
<TITLE> WAGE CALCULATOR </TITLE>
</HEAD>
<BODY>
<FORM NAME = "CALCULATOR" ACTION="calculator.asp" METHOD="POST">
<SCRIPT LANGUAGE="JavaScript">
<!--hide from incompatible browsers
<!--the function below will require that the form fields are validated-->
function confirmFields() {
var count = 0;
var missingFields = 0;
while (count < document.CALCULATOR.length -1) {
if (document.pFORM.elements[count].value =="")
missingFields = ++missingFields;
++count;
}
<!--the code below will display an alert message to the user, signalling the number of fields left empty-->
if(missingFields >0) {
alert("You are missing" + missingFields + "out of" +
(document.CALCULATOR.length -1) + "fields.");
return false;
}
else
return true;
}
//stop hiding from incompatible browsers-->
</script>
<h4> Enter the number of regular hours worked:</h4>
<INPUT TYPE="TEXT" NAME= "Regular Hours" ><br>
<h4>Enter the number of overtime hours worked:</h4>
<INPUT TYPE="TEXT" NAME="Overtime Hours" ><br>
<h4>Enter Hourly wage: $</h4>
<INPUT TYPE="TEXT" NAME="Hourly wage" ><br>
<h4>Enter your total sales:</h4>
<INPUT TYPE="TEXT" NAME="Total Sales" ><br>
<p> </P>
<input type="submit" name="submit" value="Calculate Pay"><br>
</FORM>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> WAGE CALCULATOR </TITLE>
</HEAD>
<BODY>
<%
Dim dblregHours, overHours, curhourWage, commis, Tsales, Tearnings
Tearning = (dblregHours * curhourWage) + (overHours *(curhourWage *1.5))
<p> You have earned $<% = Tearnings%> </p>
commis = Tsales * .06
<p>You have earned $<% =commis %> commision </P>
dblregHours = Request."CALCULATOR" (" Regular Hours")
overHours = Request."CALCULATOR" (" Overtime Hours")
curhourWage = Request."CALCULATOR" ("Hourly wage")
Tsales = Request."CALCULATOR" ("Total Sales")
%>
</body>
</html>
pls help,
thanks,
syma.
i have the following assignment to do. below is the question and the code from the two files. when i click on "calculate pay" in first file, it opens a page which is showing the asp code. can you pls tell me whats wrong?
the question:
Write a Web application that computes and displays the total pay for an employee. The application should accept regular hours, overtime, and the hourly wage rate for one employee, using an employee timesheet as input. The employee timesheet will be an html form. Be sure to invoke an asp function to calculate the pay.
Be sure you name the text boxes you created so you can call the information from them.
Display the output to an asp page called calculate.asp
In your code you will need to declare variables for regular hours, overtime hours, hourly wage, commission, and total sales.
You should declare the hours as double and the wage variables as currency.
"Use the following for calculating commission: Commission = Sales * .06"
You will need to calculate the total earnings by using the following formula.
(Regular hours * hourly wage) + (overtime hours *(hourly wage *1.5))
Display all this to the screen on calculate.asp with the descriptive text as well.
i am pasting the html code from the 1st one here and am attaching the second file:
<HTML>
<HEAD>
<TITLE> WAGE CALCULATOR </TITLE>
</HEAD>
<BODY>
<FORM NAME = "CALCULATOR" ACTION="calculator.asp" METHOD="POST">
<SCRIPT LANGUAGE="JavaScript">
<!--hide from incompatible browsers
<!--the function below will require that the form fields are validated-->
function confirmFields() {
var count = 0;
var missingFields = 0;
while (count < document.CALCULATOR.length -1) {
if (document.pFORM.elements[count].value =="")
missingFields = ++missingFields;
++count;
}
<!--the code below will display an alert message to the user, signalling the number of fields left empty-->
if(missingFields >0) {
alert("You are missing" + missingFields + "out of" +
(document.CALCULATOR.length -1) + "fields.");
return false;
}
else
return true;
}
//stop hiding from incompatible browsers-->
</script>
<h4> Enter the number of regular hours worked:</h4>
<INPUT TYPE="TEXT" NAME= "Regular Hours" ><br>
<h4>Enter the number of overtime hours worked:</h4>
<INPUT TYPE="TEXT" NAME="Overtime Hours" ><br>
<h4>Enter Hourly wage: $</h4>
<INPUT TYPE="TEXT" NAME="Hourly wage" ><br>
<h4>Enter your total sales:</h4>
<INPUT TYPE="TEXT" NAME="Total Sales" ><br>
<p> </P>
<input type="submit" name="submit" value="Calculate Pay"><br>
</FORM>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> WAGE CALCULATOR </TITLE>
</HEAD>
<BODY>
<%
Dim dblregHours, overHours, curhourWage, commis, Tsales, Tearnings
Tearning = (dblregHours * curhourWage) + (overHours *(curhourWage *1.5))
<p> You have earned $<% = Tearnings%> </p>
commis = Tsales * .06
<p>You have earned $<% =commis %> commision </P>
dblregHours = Request."CALCULATOR" (" Regular Hours")
overHours = Request."CALCULATOR" (" Overtime Hours")
curhourWage = Request."CALCULATOR" ("Hourly wage")
Tsales = Request."CALCULATOR" ("Total Sales")
%>
</body>
</html>
pls help,
thanks,
syma.