Ultra Geile Studenten Benutzer Oberfläche (UGSBO)
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.

68 lines
1.2 KiB

  1. /**
  2. *
  3. */
  4. package com.ugsbo.entscheider;
  5. import java.util.Scanner;
  6. import java.util.*;
  7. /**
  8. * @author bruec
  9. *
  10. */
  11. public class Entscheider {
  12. /**
  13. * @param args
  14. */
  15. public static void main(String[] args) {
  16. System.out.println(pruefen(2));
  17. }
  18. public static String ergebnis(int a, int b, int c, int d, int e, int f, int g, int h) {
  19. int erg = (((a + b + c) * d ) /e + f + g) - h;
  20. String hilfe = "";
  21. if(erg < 5) hilfe = "Ich kann doch nicht fuer dich entscheiden, dass musst du schon selber wissen.";
  22. return hilfe;
  23. }
  24. public static String fragen() {
  25. return "";
  26. }
  27. public static int skalaTest(int answer){
  28. System.out.println("Try again. Nur Werte zwischen 1 und 10 sind erlaubt.");
  29. int b = getAnInteger();
  30. if(b >= 1 && b <= 10) {
  31. return b;
  32. }
  33. skalaTest(b);
  34. return -1;
  35. }
  36. public static int getAnInteger() {
  37. Scanner in = new Scanner(System.in);
  38. while (true){
  39. try{
  40. return in.nextInt();
  41. }
  42. catch (InputMismatchException e){
  43. in.next();
  44. System.out.println("Das ist kein Integer. Try again.");
  45. }
  46. }
  47. }
  48. public static int pruefen(int answer) {
  49. System.out.println("Try again. Nur 1 und 0 sind erlaubt.");
  50. int b = getAnInteger();
  51. if(b == 1 || b == 0) {
  52. return b;
  53. }
  54. pruefen(b);
  55. return 1;
  56. }
  57. }