-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tugas1_js.html
96 lines (86 loc) · 2.38 KB
/
Tugas1_js.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!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>Tugas 1 Javascript</title>
</head>
<body>
<script lang="javascript">
// variabel pokok
var pegawai = "Ridwan"
var jabatan = "Manager"
var statusPeg ="menikah"
// gaji pokok
if (jabatan == 'Manager') {
gapok = 15000000;
} else if (jabatan == 'Asisten') {
gapok = 10000000;
} else {
gapok = 5000000;
}
// Tunjangan Jabatan
let tunjab = gapok * 0.15;
// BPJS
let bpjs = gapok * 0.1;
// Tunjangan Menikah
let tunmen = (statusPeg == 'menikah') ? gapok * 0.2 : 0;
// Total
let total = gapok + tunjab + bpjs + tunmen;
</script>
<h1>Data Pegawai</h1>
<p>Pegawai: <script>document.write(pegawai)</script></p>
<p>Jabatan: <script>document.write(jabatan)</script></p>
<p>Status: <script>document.write(statusPeg)</script></p>
<p>Gaji Pokok: Rp <script>document.write(gapok)</script></p>
<table border="1" cellpadding="10" cellspacing="0" width="30%">
<thead>
<tr bgcolor="cadetblue">
<th>
Data
</th>
<th>
Jumlah
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Tunjangan Jabatan
</td>
<td>
Rp <script>document.write(tunjab)</script>
</td>
</tr>
<tr>
<td>
BPJS
</td>
<td>
Rp <script>document.write(bpjs)</script>
</td>
</tr>
<tr>
<td>
Tunjangan Menikah
</td>
<td>
Rp <script>document.write(tunmen)</script>
</td>
</tr>
</tbody>
<tfoot>
<tr bgcolor="orange">
<td style="text-align: right;">
Total Gaji:
</td>
<td>
Rp <script>document.write(total)</script>
</td>
</tr>
</tfoot>
</table>
</body>
</html>