This repository has been archived on 2026-06-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
sgd/ysqld/ysql05d/einsende/konto.class.php
T

46 lines
1.4 KiB
PHP

<?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>";
}
}
}
?>