Page 148 - Computer Software Application TP - Volume 1
P. 148
COMPUTER SOFTWARE APPLICATION - CITS
TASK 4 : Using Nested if statements
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> Nested if statement </title>
</head>
<body>
<script>
const grade = 85;
const passingGrade = 70;
const honorRoll = 90;
if (grade >= passingGrade)
{
if (grade >= honorRoll)
{
console.log(“Excellent! You made the honor roll.”);
}
else
{
console.log(“Good job! You passed the course.”);
}
}
else
{
console.log(“You need to study more and retake the course.”);
}
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Go to the browsers console tab and verify the output.
133
CITS : IT & ITES - Computer Software Application - Exercise 39 CITS : IT & ITES - Computer Software Application - Exercise 39