Created
April 13, 2016 15:02
-
-
Save Fundibalus/3c672cc2ad5d31f91b9d6c390726760d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package og11; | |
/** | |
* | |
* @author Marlon | |
*/ | |
public class Bank { | |
public Konto testKonto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package og11; | |
/** | |
* | |
* @author Marlon | |
*/ | |
public class Konto { | |
boolean versuche = true; | |
private double kontostand = 100; | |
double Abheben(double abhbetrag) { | |
if(kontostand < 0) { | |
if(versuche == true) { | |
double überzogen = 0; | |
versuche = false; | |
return überzogen; | |
} | |
if(versuche == false) { | |
double überzogen = -1; | |
versuche = false; | |
return überzogen; | |
} | |
} | |
kontostand = kontostand - abhbetrag; | |
return abhbetrag; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package og11; | |
import java.util.Scanner; | |
public class OG11 { | |
public static void main(String[] args) { | |
boolean go = true; | |
Bank Volksbank = new Bank(); | |
Bank Sparkasse = new Bank(); | |
Konto konto1 = new Konto(); | |
while(go == true) { | |
double abhebebetrag; | |
double ergbetrag; | |
Scanner scan1 = new Scanner(System.in); | |
abhebebetrag = scan1.nextDouble(); | |
ergbetrag = konto1.Abheben(abhebebetrag); | |
System.out.println(ergbetrag); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment