-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsparkontoclass.php
More file actions
32 lines (29 loc) · 1.08 KB
/
sparkontoclass.php
File metadata and controls
32 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class Sparkonto{
protected $Kontostand; //Kontostand
private $Inhaber; //Inhaber
private $BLZ; //BLZ
private $KontoNr; //KontoNr
function __construct($Inhaber, $KontoNr, $BLZ){ //Konstruktor erzeugen
$this-> Inhaber=$Inhaber; //Inhaber definieren
$this-> KontoNr=$KontoNr; //KontoNr definieren
$this-> BLZ=$BLZ; //BLZ definieren
}
function einzahlen($Betrag){ //Funktion einzahlen()definieren
if($Betrag>0){ //Überprüfung ob Betrag über 0 ist
$this->Kontostand=$this->Kontostand+$Betrag; //Kontostand addieren
}
}
function auszahlen($Betrag){ //Funktion auszahlen()definieren
if($Betrag>0&&($this->Kontostand-$Betrag)>0){ //Überprüfung ob Genug Guthaben da
$this->Kontostand=$this->Kontostand-$Betrag; //Kontostand subtrahieren
}
}
function info(){ //Funktion info()definieren
echo 'Inhaber: '.$this->Inhaber.'<br>';
echo 'Kontonummer: '.$this->KontoNr.'<br>';
echo 'BLZ: '.$this->BLZ.'<br>';
echo 'Kontostand: '.$this->Kontostand.'<a>€</a><br>';
}
}
?>