input checking
This commit is contained in:
@ -11,30 +11,36 @@ class konto {
|
||||
}
|
||||
|
||||
[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){ # public
|
||||
[void]set_knr([int]$nr){
|
||||
[string]$this.kontonr = $nr
|
||||
}
|
||||
|
||||
[string]get_knr(){ # public
|
||||
[string]get_knr(){
|
||||
return $this.kontonr
|
||||
}
|
||||
|
||||
[void]set_ktyp($typ){ # public
|
||||
[void]set_ktyp($typ){
|
||||
$this.ktyp = $typ
|
||||
}
|
||||
|
||||
[string]get_ktyp(){ # public
|
||||
[string]get_ktyp(){
|
||||
return $this.ktyp
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user