Created
February 4, 2016 11:42
-
-
Save Fundibalus/aa34d56cdbdde75e2de5 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
static void Begruessung() { | |
System.out.println("Willkommen!Dies ist ein Taschenrechner.Geben Sie 2 Zahlen ein, um diese dann miteinander zu addieren!"); | |
} | |
static int addition(int zahl1, int zahl2) { | |
int erg = zahl1 + zahl2; | |
return erg; | |
} | |
static void Ausgabe(int erg) { | |
System.out.println("Das Ergebnis ist: " + erg); | |
} | |
public static void main(String[] args) { | |
int zahl1; | |
int zahl2; | |
Begruessung(); | |
System.out.println("Bitte geben Sie die 1. Zahl ein:"); | |
Scanner scan1 = new Scanner(System.in); | |
zahl1 = scan1.nextInt(); | |
System.out.println("Bitte geben Sie die 2. Zahl ein:"); | |
Scanner scan2 = new Scanner(System.in); | |
zahl2 = scan2.nextInt(); | |
int hallo = addition(zahl1,zahl2); | |
Ausgabe(hallo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment