aufgaben progt vom 24-12-19
This commit is contained in:
102
progp/24-12-19 -- fakultät/fahrkosten.php
Normal file
102
progp/24-12-19 -- fakultät/fahrkosten.php
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
<div class="container">
|
||||
<h1>Fahrkosten Berechnung</h1>
|
||||
<p>Bitte geben Sie die folgenden Werte ein:</p>
|
||||
<form action="">
|
||||
<label>Durschnittlicher Verbrauch: <input type="number" name="avg_verbrauch" min="1"></label><br>
|
||||
<label></label>Strecke: <input type="number" name="strecke" min="1"></label><br>
|
||||
<label>Preis pro Liter: <input type="float" name="preis_pro_liter" min="0.1"></label><br>
|
||||
<button type="submit" class="rechnen">BERECHNEN</button><br>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
$verbrauch = $_REQUEST["avg_verbrauch"];
|
||||
$strecke = $_REQUEST["strecke"];
|
||||
$preis = $_REQUEST["preis_pro_liter"];
|
||||
|
||||
$ergebnis = $verbrauch / 100; // Liter pro 100km in Liter pro km
|
||||
$ergebnis = $ergebnis * $strecke; // Liter pro km in Liter für die Strecke
|
||||
$ergebnis = $ergebnis * $preis; // Liter für die Strecke in Preis
|
||||
|
||||
echo "Die Fahrt kostet: <span>$ergebnis €</span>";
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
<style>
|
||||
.container {
|
||||
width: 50%;
|
||||
margin: 0 auto;
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
border: 10px solid #3dc21b;
|
||||
}
|
||||
span {
|
||||
color: #d32f2f;
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
}
|
||||
*{
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
margin: 10px;
|
||||
}
|
||||
.rechnen {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
|
||||
background-color: #44c767;
|
||||
border-radius: 38px;
|
||||
border: 1px solid #18ab29;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
font-family: Arial;
|
||||
font-weight: bold;
|
||||
padding: 23px 48px;
|
||||
text-decoration: none;
|
||||
animation: pulse-blur 1.5s infinite;
|
||||
margin: 25px;
|
||||
}
|
||||
|
||||
.rechnen:active {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.rechnen:hover {
|
||||
background-color: red;
|
||||
box-shadow: 0px 0px 27px 8px red;
|
||||
background: linear-gradient(to bottom, red 5%, red 100%);
|
||||
border-radius: 38px;
|
||||
border: 1px solid red;
|
||||
animation: pulse-blur-hover 1.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-blur {
|
||||
25% {
|
||||
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0px 0px 37px 12px #3dc21b;
|
||||
}
|
||||
75% {
|
||||
box-shadow: 0px 0px 27px 8px #3dc21b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@keyframes pulse-blur-hover {
|
||||
25% {
|
||||
box-shadow: 0px 0px 27px 8px red;
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0px 0px 37px 12px red;
|
||||
}
|
||||
75% {
|
||||
box-shadow: 0px 0px 27px 8px red;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
85
progp/24-12-19 -- fakultät/fakultaet.php
Normal file
85
progp/24-12-19 -- fakultät/fakultaet.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Fakultät Berechnung</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
text-align: center;
|
||||
padding: 50px;
|
||||
background-image: url('weihnachten_1.jpg');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100%;
|
||||
}
|
||||
.container {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
display: inline-block;
|
||||
}
|
||||
h1 {
|
||||
color: #d32f2f;
|
||||
}
|
||||
input[type="number"] {
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
}
|
||||
input[type="submit"] {
|
||||
padding: 10px 20px;
|
||||
background-color: #d32f2f;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
input[type="submit"]:hover {
|
||||
background-color: #b71c1c;
|
||||
}
|
||||
span {
|
||||
color: #d32f2f;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text_2 {
|
||||
font-size: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body background-image:progp\bilder\weihnachten_1.jpg>
|
||||
<div class="container">
|
||||
<h1>Fakultät Berechnung</h1>
|
||||
<form method="post">
|
||||
<label for="number">Geben Sie eine Nummer ein:</label><br>
|
||||
<input type="number" id="number" name="number" required><br>
|
||||
<input type="submit" value="Berechnen">
|
||||
</form>
|
||||
<?php
|
||||
function fak($n) {
|
||||
if ($n < 0) {
|
||||
return "Ungültige Eingabe";
|
||||
}
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
$result = 1;
|
||||
for ($i = 1; $i <= $n; $i++) {
|
||||
$result *= $i;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$number = intval($_POST["number"]);
|
||||
echo "<p class='text_2'>Die Fakultät von <span>$number</span> ist <span>" . fak($number) . "</span></p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
progp/24-12-19 -- fakultät/weihnachten_1.jpg
Normal file
BIN
progp/24-12-19 -- fakultät/weihnachten_1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 212 KiB |
Reference in New Issue
Block a user