Advertisement
Agony_

Untitled

Feb 17th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. package io;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class IO {
  8. private static String input;
  9. private static int intoutput;
  10. private static double doubleoutput;
  11. private static String stringoutput;
  12. private static boolean booleanoutput;
  13.  
  14. static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  15.  
  16. public IO () throws IOException {
  17.  
  18. }
  19. public static String readLine() throws IOException {
  20. input = in.readLine();
  21. return input;
  22.  
  23. }
  24. public static int readInteger() throws IOException {
  25. input = in.readLine();
  26. intoutput = Integer.parseInt(input);
  27. return intoutput;
  28.  
  29. }
  30. public static double readDouble() throws IOException {
  31. input = in.readLine();
  32. doubleoutput = Double.parseDouble(input);
  33. return doubleoutput;
  34. }
  35. public static boolean readBoolean() throws IOException {
  36. boolean bs = true;
  37. System.out.println("[System] Eingabemöglichkeiten für True: true,j,ja,y,yes" + "\n" +"Eingabemöglichkeiten für False: false,n,no,nein" );
  38. while (bs == true) {
  39. input = in.readLine();
  40. if (input.equalsIgnoreCase("true")||input.equalsIgnoreCase("j") || input.equalsIgnoreCase("ja") || input.equalsIgnoreCase("y") || input.equalsIgnoreCase("yes")) {
  41. booleanoutput = true;
  42. bs = false;
  43. } else if (input.equalsIgnoreCase("false")||input.equalsIgnoreCase("n") || input.equalsIgnoreCase("nein") || input.equalsIgnoreCase("no")) {
  44. booleanoutput = false;
  45. bs = false;
  46. } else {
  47. System.out.println("[System] Ungültige Eingabe !");
  48. }
  49. }
  50. return booleanoutput;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement