Created
May 10, 2014 23:49
-
-
Save jonataa/4445563434b88a9c47d3 to your computer and use it in GitHub Desktop.
Loja de Tintas
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Exercício - Loja de Tintas</title> | |
</head> | |
<body> | |
<h1>Loja de Tintas</h1> | |
<form action="tintas.php" method="POST"> | |
<label> | |
Área em M2: | |
<input type="text" name="area" /> | |
</label> | |
<input type="submit" value="Calcular" /> | |
</form> | |
</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
<?php | |
function fatura($request) | |
{ | |
$area = $request['area']; | |
$litros = ceil($area/3); | |
$latas = ceil($litros/18); | |
$custo = number_format(($latas * 80.0), 2, ',', '.'); | |
printf('Quantidade de Latas: %s Custo Total: R$ %s', $latas, $custo); | |
} | |
fatura($_REQUEST); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment