Skip to content

Commit a83555d

Browse files
committed
curso udemy adicionado
1 parent 351bb88 commit a83555d

78 files changed

Lines changed: 723 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Curso-Udemy/Seção16/index.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="pt-br">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Álcool ou Gasolina</title>
7+
8+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
9+
</head>
10+
<body class="bg-light min-vh-100 d-flex align-items-center justify-content-center">
11+
12+
<main class="container">
13+
<section class="card bg-light border rounded-1 mx-auto" style="max-width: 720px;">
14+
<div class="card-body p-4">
15+
16+
<h1 class="fw-bold text-dark mb-3">É melhor utilizar Álcool ou Gasolina?</h1>
17+
18+
<form>
19+
<div class="mb-3">
20+
<label for="alcool" class="form-label fw-bold fs-5 text-secondary">Preço do álcool</label>
21+
<input type="number" id="alcool" class="form-control form-control-lg" step="0.01">
22+
</div>
23+
24+
<div class="mb-3">
25+
<label for="gasolina" class="form-label fw-bold fs-5 text-secondary">Preço da gasolina</label>
26+
<input type="number" id="gasolina" class="form-control form-control-lg"step="0.01">
27+
</div>
28+
29+
<div id="res" class="alert alert-primary fw-bold fs-5 py-3 mb-3" role="alert"></div>
30+
31+
<button type="button" class="btn btn-primary btn-lg" onclick="calcular()">Calcular</button>
32+
33+
<button type="button" class="btn btn-primary btn-lg" onclick="limpar()">Limpar</button>
34+
</form>
35+
36+
</div>
37+
</section>
38+
</main>
39+
<script src="script.js"></script>
40+
</body>
41+
</html>

Curso-Udemy/Seção16/script.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
function calcular() {
2+
let alc = document.getElementById("alcool");
3+
let gas = document.getElementById("gasolina");
4+
let res = document.getElementById("res");
5+
6+
if (alc.value > gas.value) {
7+
res.innerHTML = "Melhor utilizar gasolina.";
8+
} else {
9+
res.innerHTML = "Melhor utilizar álcool.";
10+
}
11+
}
12+
13+
function limpar() {
14+
let alc = document.getElementById("alcool");
15+
let gas = document.getElementById("gasolina");
16+
let res = document.getElementById("res");
17+
18+
alc = alc.value = "";
19+
gas = gas.value = "";
20+
res = res.innerHTML = "";
21+
}

Curso-Udemy/Seção17/index.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="pt-br">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Frases Motivacionais</title>
7+
8+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
9+
</head>
10+
<body class="bg-light min-vh-100 d-flex align-items-center justify-content-center">
11+
12+
<main class="container">
13+
<section class="bg-secondary-subtle p-5 mx-auto" style="max-width: 900px;">
14+
15+
<h1 class="text-success fw-bold mb-3">Frases motivacionais</h1>
16+
17+
<hr>
18+
19+
<div id="frase" class="display-4 text-dark my-4"></div>
20+
21+
<hr>
22+
23+
<button type="button" class="btn btn-success btn-lg" onclick="gerarFrase()">Nova frase</button>
24+
25+
</section>
26+
</main>
27+
28+
<script src="script.js"></script>
29+
</body>
30+
</html>

Curso-Udemy/Seção17/script.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const frases = [
2+
"A disciplina vence a motivação nos dias difíceis.",
3+
"Quem melhora um pouco todo dia chega longe.",
4+
"O começo pode ser lento, mas ainda é progresso.",
5+
"Não espere estar pronto para começar.",
6+
"Errar faz parte do processo de aprender.",
7+
"A constância transforma esforço em resultado.",
8+
"Você não precisa fazer perfeito, precisa fazer.",
9+
"Cada tentativa te deixa menos iniciante.",
10+
"O progresso aparece para quem continua.",
11+
"Grandes resultados começam com pequenas ações.",
12+
"Foque no próximo passo, não na escada inteira.",
13+
"O difícil de hoje vira experiência amanhã.",
14+
];
15+
16+
let indice = 0;
17+
18+
function gerarFrase() {
19+
let frase = document.getElementById("frase");
20+
21+
frase.innerHTML = frases[indice];
22+
23+
indice++;
24+
25+
if (indice >= frases.length) {
26+
indice = 0;
27+
}
28+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Paradigma -> exemplo ou padrão a ser seguido, não se trata de uma linguagem,
2+
// mas a forma como você soluciona problemas usando uma linguagem de programação
3+
4+
// Javascript é multi paradigma
5+
6+
// Procedural
7+
// Funções que manipulam dados
8+
9+
// function verificarDisponibilidade(q,o){
10+
// let res = q - o
11+
// console.log("Disponíveis: " + res)
12+
// }
13+
14+
// let quartos = 20
15+
// let ocupados = 5
16+
// verificarDisponibilidade(quartos,ocupados)
17+
18+
// Orientado a objetos
19+
const hotel = {
20+
quartos: 20,
21+
ocupados: 10,
22+
verificarDisponibilidade: function(){
23+
let res = this.quartos - this.ocupados
24+
console.log("Disponíveis:" +res)
25+
}
26+
}
27+
28+
hotel.ocupados = 5
29+
hotel.verificarDisponibilidade()
30+
31+
32+
// Nenhum paradigma resolve todos os problemas da maneira mais fácil ou mais eficiente
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Notação Literal
2+
3+
4+
/*
5+
const hotel = {
6+
quartos: 20,
7+
ocupados: 10,
8+
piscinas: 2,
9+
verificarDisponibilidade: function(){
10+
let res = this.quartos - this.ocupados
11+
return "Disponível" + res
12+
}
13+
}
14+
hotel.quartos = 25
15+
hotel['ocupados'] = 15
16+
delete.hotel.piscinas
17+
console.log(hotel.piscinas)
18+
*/
19+
20+
21+
// Notação de construtor (objeto em branco)
22+
23+
24+
/*
25+
const hotel = new Object()
26+
hotel.quartos = 20
27+
hotel.ocupados = 10
28+
hotel.verificarDisponibilidade = function(){
29+
let res = this.quartos - this.ocupados
30+
return "Disponível" + res
31+
}
32+
console.log(hotel.quartos)
33+
hotel.verificarDisponibilidade
34+
*/
35+
36+
37+
// Criando classes (mais simples)
38+
class hotel {
39+
40+
constructor(){
41+
this.quartos = 20
42+
this.ocupados = 10
43+
}
44+
45+
verificarDisponibilidade(){
46+
let res = this.quartos - this.ocupados
47+
return "disponivel" + res
48+
}
49+
50+
}
51+
52+
const hotel = new hotel()
53+
console.log(hotel.quartos)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Pilar 1- Abstração
2+
3+
// Model, entidade, identidade, características e ações
4+
5+
class Carro {
6+
constructor(){
7+
this.marca = "Pasgostis"
8+
this.modelo = "Peygot"
9+
this.cor = "preto"
10+
this.placa = "PGT-6767"
11+
}
12+
ligar(){
13+
14+
}
15+
}
16+
17+
const carro = new Carro()
18+
// carro.modelo = "Pagottito"
19+
console.log(carro.modelo)
20+
21+
22+
// Loja virtual
23+
24+
class Produto{
25+
constructor(){
26+
// Roupas
27+
this.tamanho = "M"
28+
this.cor = "Vermelho"
29+
this.preco = "54,90"
30+
31+
// Eletronicos
32+
this.altura = "50cm"
33+
this.largura = "30cm"
34+
}
35+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Métodos - parâmetros e retornos
2+
3+
class Usuario{
4+
constructor(){
5+
this.email = ""
6+
this.senha = ""
7+
this.subtotalCompra = 0
8+
}
9+
10+
logar(){
11+
12+
let emailbd = "luizeh@gmail.com"
13+
let senhabd = "say6784310wallahi.@91"
14+
15+
if(emailbd === this.email && senhabd === this.senha){
16+
return "senha válida"
17+
} else{
18+
return "Credenciaias inválidas"
19+
}
20+
}
21+
calcularDesconto( cupom ){
22+
23+
let desconto = 0
24+
if(cupom == "DESC20"){
25+
desconto = 20
26+
} else if (cupom == "FEST10"){
27+
desconto = 10
28+
}
29+
return this.subtotalCompra - desconto
30+
}
31+
}
32+
33+
const usuario = new Usuario()
34+
usuario.subtotalCompra = 500
35+
const totalFinal = usuario.calcularDesconto("FEST10")
36+
console.log(totalFinal)
37+
// usuario.email = "luizeh@gmail.com"
38+
// usuario.senha = "say6784310wallahi.@91"
39+
40+
// let mensagem = usuario.logar()
41+
// console.log(mensagem)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Pilar - Encapsulamento
2+
3+
class Carro{
4+
constructor(){
5+
this.modelo = "Gol"
6+
this.cor = "Preto"
7+
}
8+
frear(){
9+
/* Freio com tecnologia a disco
10+
.
11+
.
12+
.
13+
.
14+
.
15+
*/
16+
console.log("CARRO PAROU!")
17+
}
18+
}
19+
20+
const carro = new Carro()
21+
carro.frear()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Encapsulamento, modificadores de acesso e getters e setter
2+
3+
class ContaBancaria {
4+
constructor(){
5+
this._numeroConta = 0
6+
this._saldo = 0
7+
}
8+
sacar(valorSaque){
9+
this._saldo = this._saldo - valorSaque
10+
}
11+
depositar(valorDeposito){
12+
this._saldo = this._saldo + valorDeposito
13+
}
14+
15+
get saldo(){
16+
return this._saldo
17+
}
18+
set saldo(novoSaldo){
19+
if(novoSaldo > 0){
20+
this._saldo = novoSaldo
21+
}
22+
}
23+
24+
25+
get numeroConta(){
26+
// Verificar se o usuário está logado
27+
return "Número : " + this._numeroConta
28+
}
29+
30+
set numeroConta( numero ){
31+
if(numero > 0){
32+
this._numeroConta = numero - 3
33+
}
34+
}
35+
36+
}
37+
const conta = new ContaBancaria()
38+
// conta.numeroConta = 70
39+
conta.saldo = 500
40+
conta.sacar(50)
41+
conta.depositar(100)
42+
43+
console.log(conta.saldo)

0 commit comments

Comments
 (0)