Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.ostfalia.gdp.ss19.s2;
- import java.util.Locale;
- import java.util.Scanner;
- /**
- * Serie2
- *
- * @author Clarissa
- *
- */
- public class Entscheidungsbaum {
- /**
- * main method
- *
- * @param args
- */
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- scanner.useLocale(Locale.ENGLISH);
- System.out.print("Gib eine Zahl ein(A): ");
- double a = scanner.nextDouble();
- System.out.print("Gib eine Zahl ein(B): ");
- double b = scanner.nextDouble();
- System.out.print("Gib eine Zahl ein(C): ");
- double c = scanner.nextDouble();
- System.out.print("Gib eine Zahl ein(D): ");
- double d = scanner.nextDouble();
- scanner.close();
- System.out.println("Eingabe: " + a + b + c + d);
- if (c > d) {
- if (a < b) {
- if (c < d) {
- System.out.println("Ergebnis = " + b);
- } else {
- System.out.println("Ergebnis = " + c);
- }
- } else {
- if (a < c) {
- System.out.println("Ergebnis = " + c);
- } else {
- System.out.println("Ergebnis = " + a);
- }
- }
- } else {
- if (b < a) {
- if (a < d) {
- System.out.println("Ergebnis = " + d);
- } else {
- System.out.println("Ergebnis = " + a);
- }
- } else {
- if (b < d) {
- System.out.println("Ergebnis = " + d);
- } else {
- System.out.println("Ergebnis = " + b);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement