Skip to content

Commit 3118680

Browse files
committed
atualizando pasta cap04
1 parent 7ce25b4 commit 3118680

31 files changed

+650
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
package-lock.json
3+
package.json

cap04 copy

Lines changed: 0 additions & 1 deletion
This file was deleted.

cap04/ativ4_1.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="style.css">
8+
<title>PROGRAMA PAR OU IMPAR</title>
9+
</head>
10+
<body>
11+
<img src="img/exerc.jpg" alt="hora">
12+
13+
<h1>Programa par ou ímpar</h1>
14+
15+
<form>
16+
<p>Número:
17+
<input type="number" id="inNumero" required>
18+
</p>
19+
<p>
20+
<input type="submit" value="Verifique se é par ou ímpar">
21+
</p>
22+
</form>
23+
<h3></h3>
24+
25+
<script src="ativ4_1.js"></script>
26+
</body>
27+
</html>

cap04/ativ4_1.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const frm = document.querySelector("form");
2+
const resp = document.querySelector("h3");
3+
4+
frm.addEventListener("submit", (e) => {
5+
e.preventDefault()
6+
7+
const num = Number(frm.inNumero.value);
8+
9+
if (num % 2 == 0) {
10+
resp.innerText = `${num} é par`
11+
} else {
12+
resp.innerText = `${num} é impar`
13+
}
14+
15+
})

cap04/ativ4_2.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="style.css">
8+
<title>Programa verifica velocidade</title>
9+
</head>
10+
<body>
11+
<img src="img/exerc.jpg" alt="hora">
12+
<h1>PROGRAMA VERIFICA VELOCIDADE</h1>
13+
14+
<form>
15+
<p>Velocidade permitida:
16+
<input type="number" id="inVelocidadeP" required>
17+
</p>
18+
<p>Velocidade do condutor:
19+
<input type="number" id="inVelocidadeC" required>
20+
</p>
21+
<p>
22+
<input type="submit" value="Verificar velocidade">
23+
</p>
24+
</form>
25+
<h3></h3>
26+
27+
28+
<script src="ativ4_2.js"></script>
29+
</body>
30+
</html>

cap04/ativ4_2.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const frm = document.querySelector("form");
2+
const resp = document.querySelector("h3");
3+
4+
frm.addEventListener("submit", (e) => {
5+
e.preventDefault()
6+
7+
const velocidadePermitida = Number(frm.inVelocidadeP.value);
8+
9+
const velocidadeCondutor = Number(frm.inVelocidadeC.value);
10+
11+
if(velocidadeCondutor <= velocidadePermitida){
12+
resp.innerText = `Situação: Sem multa.`
13+
}else{
14+
const maisVinte = velocidadePermitida * 1.2
15+
if(velocidadeCondutor <= maisVinte ){
16+
resp.innerText = `Situação: Multa leve.`
17+
}else{
18+
resp.innerText = `Situação: Multa grave.`
19+
}
20+
}
21+
22+
});
23+
24+
25+

cap04/ativ4_3.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="pt-br">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="style.css" >
8+
<title>Programa Parquímetro</title>
9+
</head>
10+
<body>
11+
<img src="img/exerc.jpg">
12+
13+
<h1>Programa Parquímetro</h1>
14+
15+
<form>
16+
<p>Valor R$:
17+
<input type="number" id="inValor" required>
18+
</p>
19+
<p>
20+
<input type="submit" value="Confirmar deposito">
21+
</p>
22+
</form>
23+
<h3></h3>
24+
<h4></h4>
25+
26+
<script src="ativ4_3.js"></script>
27+
</body>
28+
</html>

cap04/ativ4_3.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const frm = document.querySelector("form");
2+
const resp1 = document.querySelector("h3");
3+
const resp2 = document.querySelector("h4");
4+
5+
frm.addEventListener("submit", (e) => {
6+
e.preventDefault() // evita envio do form
7+
8+
const valor = Number(frm.inValor.value) // obtém número digitado no form
9+
10+
// caso valor insuficiente
11+
if (valor < 1.00) {
12+
alert("Valor Insuficiente (no mínimo, R$ 1.00)")
13+
frm.inValor.focus()
14+
return
15+
}
16+
17+
// declara variáveis
18+
let tempo
19+
let troco
20+
21+
// cria as condições para verificar tempo e troco
22+
if (valor >= 3.00) {
23+
tempo = 120
24+
troco = valor - 3.00
25+
} else if (valor >= 1.75) {
26+
tempo = 60
27+
troco = valor - 1.75
28+
} else {
29+
tempo = 30
30+
troco = valor - 1.00
31+
}
32+
33+
// exibe as respostas
34+
resp1.innerText = `Tempo: ${tempo} min`
35+
if (troco > 0) {
36+
resp2.innerText = `Troco R$: ${troco.toFixed(2)}`
37+
}
38+
})

cap04/ativ4_4.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="pt-br">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<link rel="stylesheet" href="style.css">
9+
<title>Programa lado do triângulo</title>
10+
</head>
11+
12+
<body>
13+
<img src="img/exerc.jpg" alt="hora">
14+
<h1>PROGRAMA LADO DO TRIÂNGULO</h1>
15+
16+
<form>
17+
<p>Lado A:
18+
<input type="number" id="inLadoA" min="1" required>
19+
</p>
20+
21+
<p>Lado B:
22+
<input type="number" id="inLadoB" min="1" required>
23+
</p>
24+
25+
<p>Lado C:
26+
<input type="number" id="inLadoC" min="1" required>
27+
</p>
28+
<p>
29+
<input type="submit" value="Verificar Lados">
30+
</p>
31+
32+
</form>
33+
<h3 id="simOunao"></h3>
34+
<h3 id="hehe"></h3>
35+
36+
<script src="ativ4_4.js"></script>
37+
</body>
38+
39+
</html>

cap04/ativ4_4.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const frm = document.querySelector("form");
2+
const resp1 = document.getElementById("simOunao");
3+
const resp2 = document.getElementById("hehe");
4+
5+
frm.addEventListener("submit", (e) => {
6+
e.preventDefault()
7+
8+
const ladoA = Number(frm.inLadoA.value);
9+
const ladoB = Number(frm.inLadoB.value);
10+
const ladoC = Number(frm.inLadoC.value);
11+
12+
if(ladoA >= ladoB + ladoC || ladoB >= ladoA + ladoC || ladoC >= ladoA + ladoB){
13+
resp1.innerHTML = "Lados não podem formar um triângulo";
14+
} else {
15+
resp1.innerHTML = "Lados podem formar um triângulo";
16+
17+
if (ladoA === ladoB && ladoA === ladoC){
18+
resp2.innerHTML = `Tipo: Equilátero`;
19+
} else if(ladoA === ladoB || ladoA === ladoC || ladoB === ladoC){
20+
resp2.innerHTML = `Tipo: Isóceles`;
21+
} else {
22+
resp2.innerHTML = `Tipo: Escaleno`;
23+
}
24+
}
25+
})

0 commit comments

Comments
 (0)