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.

65 lines
1.1 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. return "";
  20. }
  21. public static String fragen() {
  22. return "";
  23. }
  24. public static int skalaTest(int answer){
  25. System.out.println("Try again. Nur Werte zwischen 1 und 10 sind erlaubt.");
  26. int b = getAnInteger();
  27. if(b >= 1 && b <= 10) {
  28. return b;
  29. }
  30. skalaTest(b);
  31. return -1;
  32. }
  33. public static int getAnInteger() {
  34. Scanner in = new Scanner(System.in);
  35. while (true){
  36. try{
  37. return in.nextInt();
  38. }
  39. catch (InputMismatchException e){
  40. in.next();
  41. System.out.println("Das ist kein Integer. Try again.");
  42. }
  43. }
  44. }
  45. public static int pruefen(int answer) {
  46. System.out.println("Try again. Nur 1 und 0 sind erlaubt.");
  47. int b = getAnInteger();
  48. if(b == 1 || b == 0) {
  49. return b;
  50. }
  51. pruefen(b);
  52. return 1;
  53. }
  54. }