|
@ -1,5 +1,7 @@ |
|
|
package programmiermethoden_und_Werkzeuge; |
|
|
package programmiermethoden_und_Werkzeuge; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
|
public class Taschenrechner { |
|
|
public class Taschenrechner { |
|
|
int addition(int a, int b) { |
|
|
int addition(int a, int b) { |
|
|
|
|
|
|
|
@ -60,5 +62,23 @@ public class Taschenrechner { |
|
|
void startTaschenrechner() { |
|
|
void startTaschenrechner() { |
|
|
//Funktion zum Starten des Taschenrechnerprogramms |
|
|
//Funktion zum Starten des Taschenrechnerprogramms |
|
|
System.out.println("1.Addition, 2.Multiplikation, 3.Division, 4.Potenzieren, 5.kleinerAls, 6.groeßerAls, 7.Gleichgroß, 8.Zufällige Zahl, 9.PI"); |
|
|
System.out.println("1.Addition, 2.Multiplikation, 3.Division, 4.Potenzieren, 5.kleinerAls, 6.groeßerAls, 7.Gleichgroß, 8.Zufällige Zahl, 9.PI"); |
|
|
|
|
|
Scanner scan = new Scanner(System.in); |
|
|
|
|
|
|
|
|
|
|
|
int s = scan.nextInt(); |
|
|
|
|
|
|
|
|
|
|
|
switch (s) { |
|
|
|
|
|
case 1: { |
|
|
|
|
|
|
|
|
|
|
|
addition(s, s); |
|
|
|
|
|
} |
|
|
|
|
|
case 2: { |
|
|
|
|
|
|
|
|
|
|
|
division(s, s); |
|
|
|
|
|
} |
|
|
|
|
|
default: |
|
|
|
|
|
throw new IllegalArgumentException("Unexpected value: " + s); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |