forked from codemistic/Web-Development
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrade Calc.html
More file actions
74 lines (64 loc) · 2.37 KB
/
Grade Calc.html
File metadata and controls
74 lines (64 loc) · 2.37 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="design.css">
</head>
<body>
<button class="refresh" onclick="window.location.reload()">Check Another Result </button>
<section class="box">
<div class="vl"></div>
<div class="wrapper">
<input class="input" type="text" placeholder="PHYSICS" id="phy">
<hr>
<input class="input" type="text" placeholder="CHEMISTRY" id="che">
<hr>
<input class="input" type="text" placeholder="MATHS" id="maths">
<hr>
<input class="input" type="text" placeholder="BIOLOGY" id="bio">
<hr>
<input type="button" name="" value="showPercentage" class="app-form-button" onclick="calcy()">
</div>
<div class="header">STUDENT <br> GRADE <br> CALC</div>
<div class="show">
<p id="showData"></p>
</div>
</section>
<script>
const calcy = () =>{
let phy = document.getElementById('phy').value ;
let maths = document.getElementById('che').value ;
let che = document.getElementById('maths').value ;
let bio = document.getElementById('bio').value ;
let grades="";
let totalGrades = parseFloat(phy) + parseFloat(maths) + parseFloat(che) + parseFloat(bio);
// alert(totalGrades);
let perc = (totalGrades/400) * 100 ;
//alert(perc);
if(perc <= 100 && perc >= 80){
grades='A' ;
}else if(perc <= 79 && perc >= 60){
grades='B';
}else if(perc <= 59 && perc >= 40){
grades='C';
}else if (perc>100){
grades='Invalid'
}
else {
grades='F';
}
if (perc >=40){
document.getElementById('showData').innerHTML= `Out of 400 your Total is ${totalGrades} and percentage is ${perc}%. <br> Your grade is ${grades}. You are PASS `
}else{
document.getElementById('showData').innerHTML= `Out of 400 your Total is ${totalGrades} and percentage is ${perc}%. <br> Your grade is ${grades}. Better Luck Next Time. `
} if(perc>100){
document.getElementById('showData').innerHTML= `Please Enter Valid Data`
}
}
</script>
<p class="saka">Developed_@sakaX</p>
</body>
</html>