sumidave
12-16-2006, 04:38 AM
THis is the question
Write a compound conditional statement that tests whether a previously declared variable named finalScore is greater than or equal to 90, less than 90 but greater than or equal to 80, less than 80 but greater than or equal to 70, or less than 70. Do not use any logical operators (“and” or “or”). Depending on which condition is satisfied, the code should display an alert box message with an appropriate message (e.g., “Final score is in the 80s” or “Final score is below 70”).
_______________________________________________________________
Here are the coding... did i missed out something... please help me!:( :confused:
<html>
<head>
<title>Question 4</title>
<script type="text/javascript">
<!--
var finalScore,
finalScore=window.prompt( "Enter a final score:",'');
if (finalScore<70)
{
document.writeln(finalscore.Final score is below 70);
}
else if(finalScore<80)
{
document.writeln(finalscore.Final score is in the 70s);
}
if (finalScore<90)
{
document.writeln(finalscore.Final score is in the 80s);
}
else{
document.writeln(finalscore.Final score is over 90);
}
alert(finalscore)
//-->
</script>
</head>
<body>
<p>Click Refresh (or Reload) to run the script again<p>
</body>
</html>
Write a compound conditional statement that tests whether a previously declared variable named finalScore is greater than or equal to 90, less than 90 but greater than or equal to 80, less than 80 but greater than or equal to 70, or less than 70. Do not use any logical operators (“and” or “or”). Depending on which condition is satisfied, the code should display an alert box message with an appropriate message (e.g., “Final score is in the 80s” or “Final score is below 70”).
_______________________________________________________________
Here are the coding... did i missed out something... please help me!:( :confused:
<html>
<head>
<title>Question 4</title>
<script type="text/javascript">
<!--
var finalScore,
finalScore=window.prompt( "Enter a final score:",'');
if (finalScore<70)
{
document.writeln(finalscore.Final score is below 70);
}
else if(finalScore<80)
{
document.writeln(finalscore.Final score is in the 70s);
}
if (finalScore<90)
{
document.writeln(finalscore.Final score is in the 80s);
}
else{
document.writeln(finalscore.Final score is over 90);
}
alert(finalscore)
//-->
</script>
</head>
<body>
<p>Click Refresh (or Reload) to run the script again<p>
</body>
</html>