-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch_39_42.html
51 lines (51 loc) · 1.38 KB
/
ch_39_42.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Chapter 39-42</title>
</head>
<body>
<script>
var English=prompt("Enter your English Marks");
var Maths=prompt("Enter your Maths Marks");
var Urdu=prompt("Enter your Urdu Marks");
var Social_studies=prompt("Enter your social studies Marks");
var Islamiat=prompt("Enter your Islamiat Marks");
var obtainMarks=parseInt(English) +parseInt (Maths) +parseInt (Urdu) +parseInt (Social_studies) +parseInt (Islamiat);
var totalMarks=500;
var percentage=obtainMarks/totalMarks * 100;
console.log("Your percentage is "+ percentage + '%');
var grade;
switch(true){
case(percentage >=90 && percentage <=100):
grade="A+";
alert("Grade= " +grade);
break;
case(percentage >=75 && percentage <=89):
grade= "A";
alert("Grade= "+ grade);
break;
case(percentage >=60 && percentage <=74):
grade= "B";
alert("Grade ="+grade);
break;
case (percentage >=45 && percentage <=59):
grade="C";
alert("Grade ="+grade);
break;
case (percentage >=30 && percentage <=44):
grade="D";
alert("Grade ="+grade);
break;
case (percentage >=0 && percentage <=29):
grade="F";
alert("Grade ="+grade);
break;
default:
alert("Invalid Marks");
}
</script>
</body>
</html>