Files
kla-opp-schulzeug/12fi5/AEuP/Konto/konto.ps1
2021-10-21 12:31:41 +02:00

46 lines
933 B
PowerShell

class konto {
[string]$kontonr
[string]$ktyp
[string]$kunde
[double]$guthaben
[string]$erstelldatum
konto() {
$this.guthaben = 0
$this.erstelldatum = Get-Date
}
[double]einzahlen([double]$menge) {
if ($menge -lt 0) {
throw "Einzahlungsmenge muss positiv sein!"
}
$this.guthaben += $menge
return $this.guthaben
}
[double]auszahlen([double]$menge) {
if ($menge -lt 0) {
throw "Auszahlungsmenge muss positiv sein!"
}
if (($this.guthaben - $menge) -gt (-1000)) {
$this.guthaben -= $menge
}
return $this.guthaben
}
[void]set_knr([int]$nr){
[string]$this.kontonr = $nr
}
[string]get_knr(){
return $this.kontonr
}
[void]set_ktyp($typ){
$this.ktyp = $typ
}
[string]get_ktyp(){
return $this.ktyp
}
}