Advertisement
clrdz

Untitled

Mar 25th, 2019
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. package de.ostfalia.gdp.ss19.s2;
  2.  
  3. import java.util.Locale;
  4. import java.util.Scanner;
  5.  
  6. /**
  7. * Serie2
  8. *
  9. * @author Clarissa
  10. *
  11. */
  12. public class Entscheidungsbaum {
  13. /**
  14. * main method
  15. *
  16. * @param args
  17. */
  18. public static void main(String[] args) {
  19. Scanner scanner = new Scanner(System.in);
  20. scanner.useLocale(Locale.ENGLISH);
  21. System.out.print("Gib eine Zahl ein(A): ");
  22. double a = scanner.nextDouble();
  23. System.out.print("Gib eine Zahl ein(B): ");
  24. double b = scanner.nextDouble();
  25. System.out.print("Gib eine Zahl ein(C): ");
  26. double c = scanner.nextDouble();
  27. System.out.print("Gib eine Zahl ein(D): ");
  28. double d = scanner.nextDouble();
  29. scanner.close();
  30.  
  31. System.out.println("Eingabe: " + a + b + c + d);
  32.  
  33. if (c > d) {
  34. if (a < b) {
  35. if (c < d) {
  36. System.out.println("Ergebnis = " + b);
  37. } else {
  38. System.out.println("Ergebnis = " + c);
  39. }
  40. } else {
  41. if (a < c) {
  42. System.out.println("Ergebnis = " + c);
  43. } else {
  44. System.out.println("Ergebnis = " + a);
  45. }
  46. }
  47.  
  48. } else {
  49. if (b < a) {
  50. if (a < d) {
  51. System.out.println("Ergebnis = " + d);
  52. } else {
  53. System.out.println("Ergebnis = " + a);
  54. }
  55. } else {
  56. if (b < d) {
  57. System.out.println("Ergebnis = " + d);
  58. } else {
  59. System.out.println("Ergebnis = " + b);
  60. }
  61. }
  62. }
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement