Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Eingabe extends Taschenrechner3 {
  4. double a;
  5. double b;
  6. int operation;
  7. private Scanner scin = new Scanner(System.in);
  8.  
  9. public Eingabe(){
  10. this.a= this.getInput("bitte geben sie die erste zahl ein");
  11. this.b= this.getInput("bitte geben sie die zweite zahl ein");
  12. this.operation = (int) this.getInput("bitte geben sie eine oppertation ein\n (1= addieren 2=subtraieren \n3=multi 4= div 5=prozent)");}
  13.  
  14. public double getInput(String string)
  15. {
  16. System.out.println(string);
  17. return Double.parseDouble(scin.next());
  18. }
  19. public void rechnung(){
  20.  
  21. if ( operation==1){
  22. addition( a, b);
  23. System.out.println(super.addition( a, b));
  24. }
  25. else if (operation==2){
  26. subtraktion(a, b);
  27. }
  28. else if (operation==3){
  29. multiplikation(a, b);
  30.  
  31. }
  32. else if (operation==4 ){
  33. division(a, b);
  34. }
  35.  
  36. else if (operation == 5){
  37. prozent(a, b);
  38. }
  39. else if (operation== 6){
  40. potenz(a, b);
  41. }
  42. else if (a > 6){
  43. System.out.println("Ihre Eingabe ist ungültig");
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. public static void main(String[]args){
  57. new Eingabe();
  58. new Taschenrechner3();
  59. new Alientaschenrechner();
  60.  
  61. }
  62. }
Add Comment
Please, Sign In to add comment