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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. package programmiermethoden_und_Werkzeuge;
  2. public class Taschenrechner {
  3. int addition(int a, int b) {
  4. return a + b;
  5. }
  6. int multiplikation(int a, int b) {
  7. return a * b;
  8. }
  9. int division(int a, int b) {
  10. return a / b;
  11. }
  12. int potenzieren(int a, int b) {
  13. int temp = 1;
  14. if(b == 0) {
  15. return 1;
  16. }
  17. for(int i = 0; i < b; i++) {
  18. temp = temp * a;
  19. }
  20. return temp;
  21. }
  22. boolean kleinerAls(int a, int b) {
  23. return a < b;
  24. }
  25. boolean groeßerAls(int a, int b) {
  26. return a > b;
  27. }
  28. boolean gleich(int a, int b) {
  29. return a == b;
  30. }
  31. int randomNummer(int a, int b) {
  32. //Zufällige Nummer von a bis b
  33. int temp = 0;
  34. temp = (int) (Math.random() * (b + 1) ) + a;
  35. return temp;
  36. }
  37. double pie() {
  38. return Math.PI;
  39. }
  40. void startTaschenrechner() {
  41. //Funktion zum Starten des Taschenrechnerprogramms
  42. System.out.println("1.Addition, 2.Multiplikation, 3.Division, 4.Potenzieren, 5.kleinerAls, 6.groeßerAls, 7.Gleichgroß, 8.Zufällige Zahl, 9.PI");
  43. }
  44. }