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.

72 lines
1.5 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(ergebnis(29,1,1,3,2,1,1,4));
  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. if(erg >= 5 && erg < 15) hilfe = "Naja, dann geh halt nach Hause und ruh dich aus.";
  23. if(erg >= 15) hilfe = "Jetzt wieder gehen? Dann bist du doch voellig umsonst aufgestanden. Geh einfach hin.";
  24. return hilfe;
  25. }
  26. public static String fragen() {
  27. return "";
  28. }
  29. public static int skalaTest(int answer){
  30. System.out.println("Try again. Nur Werte zwischen 1 und 10 sind erlaubt.");
  31. int b = getAnInteger();
  32. if(b >= 1 && b <= 10) {
  33. return b;
  34. }
  35. skalaTest(b);
  36. return -1;
  37. }
  38. public static int getAnInteger() {
  39. Scanner in = new Scanner(System.in);
  40. while (true){
  41. try{
  42. return in.nextInt();
  43. }
  44. catch (InputMismatchException e){
  45. in.next();
  46. System.out.println("Das ist kein Integer. Try again.");
  47. }
  48. }
  49. }
  50. public static int pruefen(int answer) {
  51. System.out.println("Try again. Nur 1 und 0 sind erlaubt.");
  52. int b = getAnInteger();
  53. if(b == 1 || b == 0) {
  54. return b;
  55. }
  56. pruefen(b);
  57. return 1;
  58. }
  59. }