2
0

add: files from last time and task

This commit is contained in:
cwikladaniel
2025-11-20 10:33:46 +01:00
parent 25f63a161b
commit be203da14d
5 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
class Konto{
private string $iban;
private string $kontoInhaber;
private float $kontoStand;
private float $dispoRahmen;
public function __construct(string $cIban, string $cInhaber, float $cdispo) {
$this->iban = $cIban;
$this->kontoInhaber = $cInhaber;
$this->dispoRahmen = $cdispo;
$this->kontoStand = 0.0;
}
// SETTER
public function setDispoRahmen(float $sDispo){
$this->dispoRahmen = $sDispo;
}
// GETTER
public function getIban():string {
return $this->iban;
}
public function getKontoInhaber():string {
return $this->kontoInhaber;
}
public function getDispoRahmen():string {
return $this->dispoRahmen;
}
// Methoden
public function einzahlen(float $betrag){
$this->kontoStand += $betrag;
}
public function auszahlen(float $betrag) {
if ($betrag >= $this->kontoStand){
$this->kontoStand -= $betrag;
} else if ($betrag >= $this->dispoRahmen){
$this->dispoRahmen -= $betrag;
}
}
public function ausgeben(){
echo "<h1> Kontodaten: </h1>";
echo "<p><strong>IBAN:</strong> $this->iban</p>";
echo "<p><strong>Kontoinhaber:</strong> $this->kontoInhaber</p>";
echo "<p><strong>Disporahmen:</strong> $this->dispoRahmen</p>";
echo "<p><strong>Kontostand:</strong> $this->kontoStand</p>";
}
}
?>