-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrud.html
65 lines (60 loc) · 2.66 KB
/
crud.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>input nilai</title>
</head>
<body>
<fieldset>
<h3>NILAI MAHASISWA</h3>
<label>masukkan nilai absensi</label>
<input id="absensi" type="number" placeholder="Masukkan angka"><br>
<label>masukkan nilai tugas</label>
<input id="tugas" type="number" placeholder="Masukkan angka"><br>
<label>masukkan nilai UTS</label>
<input id="uts" type="number" placeholder="Masukkan angka"><br>
<label>masukkan nilai UAS</label>
<input id="uas" type="number" placeholder="Masukkan angka"><br><br>
<button onclick="kalkulasi()" style="margin-bottom: 10px; background-color: aqua; padding: 5px; ">kalkulasi nilai</button>
<fieldset style="background-color:rgb(181, 255, 193); padding: 20px;">
<legend>hasil nilai mahasiswa</legend>
nilai absensi : <span id="hasil_absen"></span><br>
nilai tugas : <span id="hasil_tugas"></span><br>
nilai uts : <span id="hasil_uts"></span><br>
nilai uas : <span id="hasil_uas"></span><br>
nilai akhir : <span id="akhir"></span>
grade nilai : <span id="grade_n"></span>
</fieldset>
</fieldset>
<script>
function kalkulasi(){
let n_absen = document.getElementById("absensi").value;
let n_tugas = document.getElementById("tugas").value;
let n_uts = document.getElementById("uts").value;
let n_uas = document.getElementById("uas").value;
let n_akhir = (n_absen * 10)/100 + (n_tugas*20)/100 + (n_uts * 30)/100 + (n_uas * 40)/100
document.getElementById("hasil_absen").innerHTML = n_absen;
document.getElementById("hasil_tugas").innerHTML = n_tugas;
document.getElementById("hasil_uts").innerHTML = n_uts;
document.getElementById("hasil_uas").innerHTML = n_uas;
document.getElementById("akhir").innerHTML = n_akhir;
let n_grade;
if (n_akhir < 20){
n_grade = "E";
}else if (n_akhir >= 20 && n_akhir < 40){
n_grade ="D";
}else if (n_akhir >= 40 && n_akhir < 60){
n_grade = "C";
}else if(n_akhir >= 60 && n_akhir < 80){
n_grade = "B";
}else if (n_akhir >= 80 && n_akhir <=100){
n_grade = "A";
}else{
n_grade = "hitungan eror";
}
document.getElementById("grade_n").innerHTML = n_grade;
}
</script>
</body>
</html>