Completed assignment.

This commit is contained in:
2025-11-12 09:23:31 +01:00
parent 329c6a5069
commit fcc0ae8f9c
4 changed files with 104 additions and 0 deletions

51
test.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
$liter1 = 40.5;
$liter2 = 35.7;
$preis = 1.499;
$gesamtLiter = $liter1 + $liter2;
$kostenFuellung1 = $liter1 * $preis;
$kostenFuellung2 = $liter2 * $preis;
$gesamtKosten = $gesamtLiter * $preis;
$fmtK1 = number_format($kostenFuellung1, 2, ',', '.');
$fmtK2 = number_format($kostenFuellung2, 2, ',', '.');
$fmtKG = number_format($gesamtKosten, 2, ',', '.');
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Tankstellenberechnung (Aufgabe 3)</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<h1>Tankstellenberechnung</h1>
<nav>
<p><a href="index.php">Start</a> | <a href="info.php">PHP Info</a></p>
</nav>
<p>Füllung 1: <?= $liter1 ?> L</p>
<p>Füllung 2: <?= $liter2 ?> L</p>
<p>Gesamtmenge: <?= $gesamtLiter ?> L</p>
<p>Kosten Füllung 1: <?= $fmtK1 ?> €</p>
<p>Kosten Füllung 2: <?= $fmtK2 ?> €</p>
<p>Gesamtkosten: <strong><?= $fmtKG ?> €</strong></p>
<table class="calc">
<thead>
<tr><th>Bezeichnung</th><th>Wert</th></tr>
</thead>
<tbody>
<tr><td>Füllung 1 (L)</td><td><?= $liter1 ?></td></tr>
<tr><td>Füllung 2 (L)</td><td><?= $liter2 ?></td></tr>
<tr><td>Gesamt (L)</td><td><?= $gesamtLiter ?></td></tr>
<tr><td>Kosten Füllung 1 (€)</td><td><?= $fmtK1 ?></td></tr>
<tr><td>Kosten Füllung 2 (€)</td><td><?= $fmtK2 ?></td></tr>
<tr><td>Gesamtkosten (€)</td><td><strong><?= $fmtKG ?></strong></td></tr>
</tbody>
</table>
</body>
</html>