-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b2d7f2e
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!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>Churrascômetro</title> | ||
<link rel="stylesheet" href="styles/style.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
|
||
<h1>Churrascômetro</h1> | ||
<input id="adultos" name="adultos" type="number" placeholder="Adultos"> | ||
<input id="criancas" name="criancas" type="number" placeholder="Crianças"> | ||
<input id="duracao" name="duracao" type="number" placeholder="Duração (h)"> | ||
|
||
<button onclick="calcular()">Calcular</button> | ||
<div id="resultado"> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<script src="scripts/script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
let inputAdultos = document.getElementById("adultos"); | ||
let inputCriancas = document.getElementById("criancas"); | ||
let inputDuracao = document.getElementById("duracao"); | ||
|
||
let resultado = document.getElementById("resultado") | ||
|
||
function calcular(){ | ||
console.log("Calculando..."); | ||
|
||
let adultos = inputAdultos.value; | ||
let criancas = inputCriancas.value; | ||
let duracao = inputDuracao.value; | ||
|
||
let qdtTotalCarne = carnePP(duracao) * adultos + (carnePP(duracao) / 2 * criancas); | ||
let qdtTotalCerveja = cervejaPP(duracao) * adultos; | ||
let qdtTotalBebidas = bebidasPP(duracao) * adultos + (bebidasPP(duracao) / 2 * criancas); | ||
|
||
|
||
resultado.innerHTML = `<p>${qdtTotalCarne / 1000} Kg de Carne</p>` | ||
resultado.innerHTML += `<p>${Math.ceil(qdtTotalCerveja / 355)} Latas de Cerveja</p>` | ||
resultado.innerHTML += `<p>${Math.ceil(qdtTotalBebidas/2000)} Pet's 2L de Bebidas</p>` | ||
|
||
|
||
|
||
|
||
} | ||
|
||
function carnePP(duracao){ | ||
if(duracao >= 6){ | ||
return 650; | ||
}else{ | ||
return 400 | ||
} | ||
} | ||
|
||
function cervejaPP(duracao){ | ||
if(duracao >= 6){ | ||
return 2000; | ||
}else{ | ||
return 1200 | ||
} | ||
} | ||
|
||
function bebidasPP(duracao){ | ||
if(duracao >= 6){ | ||
return 1500; | ||
}else{ | ||
return 1000 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
body{ | ||
background-color: gray; | ||
} | ||
|
||
.container{ | ||
font-family: Arial, Helvetica, sans-serif; | ||
max-width: 300px; | ||
margin: auto; | ||
background-color: rgb(15, 177, 0); | ||
padding: 20px; | ||
border-radius: 10px; | ||
margin-top: 150px; | ||
|
||
} | ||
|
||
input{ | ||
width: 100%; | ||
display: block; | ||
padding: 5px; | ||
box-sizing: border-box; | ||
margin-bottom: 20px; | ||
} | ||
|
||
|
||
|