-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitchcase.html
More file actions
35 lines (30 loc) · 947 Bytes
/
switchcase.html
File metadata and controls
35 lines (30 loc) · 947 Bytes
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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Switch Case</title>
<script>
/*
Verificar o aumento de salário de acordo com os serguintes cargos:
Estagiário: 100%
Analista: 50%
Gerente: 30%
Presidente: 10%
*/
const salario = prompt('Digite o Salário');
const cargo = prompt('Digite o Cargo');
let aumento = 0;
switch(cargo) {
case "Estagiário": aumento = 1; break;
case "Analista": aumento = 0.5; break;
case "Gerente": aumento = 0.3; break;
case "Presidente": aumento = 0.1; break;
default: alert('Por favor, escolha um cargo válido.')
}
const novoSalario = salario + (salario*aumento)
console.log("O novo salário é: R$ " + novoSalario)
</script>
</head>
<body>
</body>
</html>