You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1017 B
64 lines
1017 B
package programmiermethoden_und_Werkzeuge;
|
|
|
|
public class Taschenrechner {
|
|
int addition(int a, int b) {
|
|
|
|
return a + b;
|
|
}
|
|
|
|
int multiplikation(int a, int b) {
|
|
|
|
return a * b;
|
|
}
|
|
|
|
int division(int a, int b) {
|
|
|
|
return a / b;
|
|
}
|
|
|
|
int potenzieren(int a, int b) {
|
|
|
|
int temp = 1;
|
|
|
|
if(b == 0) {
|
|
return 1;
|
|
}
|
|
|
|
for(int i = 0; i < b; i++) {
|
|
temp = temp * a;
|
|
}
|
|
|
|
return temp;
|
|
}
|
|
|
|
boolean kleinerAls(int a, int b) {
|
|
|
|
return a < b;
|
|
}
|
|
|
|
boolean groeßerAls(int a, int b) {
|
|
return a > b;
|
|
}
|
|
|
|
boolean gleich(int a, int b) {
|
|
return a == b;
|
|
}
|
|
|
|
int randomNummer(int a, int b) {
|
|
//Zufällige Nummer von a bis b
|
|
int temp = 0;
|
|
|
|
temp = (int) (Math.random() * (b + 1) ) + a;
|
|
|
|
return temp;
|
|
}
|
|
|
|
double pie() {
|
|
return Math.PI;
|
|
}
|
|
|
|
void startTaschenrechner() {
|
|
//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");
|
|
}
|
|
}
|