Skip to content

Commit 8ad5f18

Browse files
committed
Adicionando mais exercicios e modificando funções
1 parent e2043dc commit 8ad5f18

8 files changed

+101
-12
lines changed

bhaskara.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function Bhaskara(a, b, c) {
2+
const delta = b * b - 4 * a * c;
3+
const x1 = (-b + Math.sqrt(delta)) / (2 * a);
4+
const x2 = (-b - Math.sqrt(delta)) / (2 * a);
5+
return (`Bhaskara x1: ${x1.toFixed(2)} e Bhaskara x2: ${x2.toFixed(2)}`)
6+
//return -b +- Math.sqrt(b ** 2 - 4* a * c) /2* a
7+
}
8+
9+
console.log(Bhaskara(1, 25, 2))

bolsaDeValores.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
function AplicaçãoSimples(capital, juroSimples, tempo) {
2-
console.log(capital * juroSimples * tempo)
1+
function juroSimples(capital, taxa, tempo) {
2+
console.log(capital * taxa * tempo)
33
}
44

5-
AplicaçãoSimples(100, 1, 30)
6-
7-
function AplicaçãoComposta(capital, juroComposto, tempo) {
8-
console.log((capital * (1 + juroComposto) ** tempo).toFixed(2))
5+
function juroComposto(capital, taxa, tempo) {
6+
const taxaTotal = 1 + taxa / 100
7+
console.log((capital * (taxaTotal ** tempo)).toFixed(2))
98
}
109

11-
AplicaçãoComposta(100, 1, 30)
10+
juroSimples(1200, 0.02, 15)
11+
juroComposto(100, 1, 12)

dataValida.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function Validar(semana) {
2+
switch(semana){
3+
case 1:
4+
console.log('Data valida')
5+
break;
6+
case 2:
7+
console.log('Data invalida')
8+
break;
9+
case 3:
10+
console.log('Data invalida')
11+
break;
12+
case 4:
13+
console.log('Data invalida')
14+
break;
15+
case 5:
16+
console.log('Data invalida')
17+
break;
18+
case 6:
19+
console.log('Data invalida')
20+
break;
21+
case 7:
22+
console.log('Data valida')
23+
break;
24+
}
25+
}
26+
27+
Validar(5)

dinheiro.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ function Dinheiro(valor1, valor2) {
55
Dinheiro(0.1, 0.2)
66

77
/* Arrow */
8-
const Valores = () => {
9-
const resultado = valor1 + valor2.toFixed(2)
10-
console.log(resultado)
8+
const Funcao = (valor1, valor2) => {
9+
return (valor1 + valor2).toFixed(2)
1110
}
12-
13-
Dinheiro(0.1, 0.2)
11+
console.log(Funcao(0.1, 0.2))

divisivel.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function Divisão(num) {
2+
return num % 3 == 0
3+
}
4+
console.log(Divisão(10))
5+
6+
console.log(Divisão(3))
7+
8+
console.log(Divisão(6))

fatorial.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function Fatorial(x) {
2+
if (x === 0) return 1;
3+
if (x === 1) return 1;
4+
return x * Fatorial(x - 1);
5+
}
6+
7+
console.log(Fatorial(6))
8+

notaEscolar.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//const Arredondamento = nota.map(function(item) {
2+
// return Math.round(item)
3+
//});
4+
5+
function classifica(nota) {
6+
let notaCorrigida = arredondar(nota)
7+
if (nota >= 40) {
8+
console.log(`Parabens, você foi aprovado! ${notaCorrigida}`);
9+
} else {
10+
console.log(`Reprovado com a nota ${notaCorrigida}`);
11+
}
12+
}
13+
14+
function arredondar (nota) {
15+
if (nota % 5 > 2) {
16+
return nota + (5 - (nota % 5))
17+
} else {
18+
return nota
19+
}
20+
}
21+
22+
classifica(36.5)
23+
classifica(70.5)
24+
classifica(76)
25+
classifica(50)
26+
classifica(39.5)
27+

pontuações.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const partida = '7'
2+
const setPartida = '7, 14, 13, 20, 17'
3+
4+
const [partida, setPartida] = useState([""]);
5+
6+
function Rounds() {
7+
if(partida > setPartida){
8+
`${setPartida}`
9+
} else (partida < setPartida)
10+
}
11+
12+
console.log(Rounds)

0 commit comments

Comments
 (0)