Voll Upload SGD Fachinformatiker PHP

This commit is contained in:
2026-06-03 13:46:32 +00:00
parent 1256ec2190
commit 84a568d89c
265 changed files with 9961 additions and 2 deletions
+60
View File
@@ -0,0 +1,60 @@
<?php
class Konto
{
private int $kontonummer;
private float $kontostand;
private string $inhaber;
public function __construct($kn = 000000, $ks = 000.00, $ki = "max, Mustermann")
{
$this->kontonummer = $kn;
$this->kontostand = $ks;
$this->inhaber = $ki;
echo "<p>Konto: " .$this->kontonummer ." wurde erfolgreich angelegt</p>";
echo "<p>Kontoinhaber: " .$this->inhaber ."</p>";
echo "<p>Kontostand: " .$this->kontostand ." Euro</p>";
echo "<hr><br><hr>";
}
public function einzahlung(float $wert)
{
$this->kontostand = $this->kontostand + $wert;
echo "<p>Der Betrag " .$wert ."€ wurde auf das Konto mit der Kontonummer " .$this->kontonummer ." eingezahlt. <br>";
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
echo "<hr><hr>";
}
public function abheben(float $wert)
{
if ($this->kontostand - $wert >= 0)
{
$this->kontostand = $this->kontostand - $wert;
echo "<p>Der Betrag " .$wert ."€ wurde vom Konto mit der Kontonummer " .$this->kontonummer ." ausgezahlt. <br>";
echo "Neuer Kontostand beträgt: " .$this->kontostand ."€</p>";
echo "<hr><hr>";
}
else
{
echo "<p>Nicht genug Guthaben zum Auszahlen auf dem Konto " .$this->kontonummer ."</p>";
}
}
}
$mayer = new Konto(123, 1000, "Meier, Hans");
$mayer->einzahlung(500.50);
$schulze = new Konto(789, 12300.5, "Schulze, Claudia");
$schulze->einzahlung(20.50);
$mayer->abheben(50.75);
$schulze->abheben(20000);
?>