Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package io;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class IO {
- private static String input;
- private static int intoutput;
- private static double doubleoutput;
- private static String stringoutput;
- private static boolean booleanoutput;
- static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- public IO () throws IOException {
- }
- public static String readLine() throws IOException {
- input = in.readLine();
- return input;
- }
- public static int readInteger() throws IOException {
- input = in.readLine();
- intoutput = Integer.parseInt(input);
- return intoutput;
- }
- public static double readDouble() throws IOException {
- input = in.readLine();
- doubleoutput = Double.parseDouble(input);
- return doubleoutput;
- }
- public static boolean readBoolean() throws IOException {
- boolean bs = true;
- System.out.println("[System] Eingabemöglichkeiten für True: true,j,ja,y,yes" + "\n" +"Eingabemöglichkeiten für False: false,n,no,nein" );
- while (bs == true) {
- input = in.readLine();
- if (input.equalsIgnoreCase("true")||input.equalsIgnoreCase("j") || input.equalsIgnoreCase("ja") || input.equalsIgnoreCase("y") || input.equalsIgnoreCase("yes")) {
- booleanoutput = true;
- bs = false;
- } else if (input.equalsIgnoreCase("false")||input.equalsIgnoreCase("n") || input.equalsIgnoreCase("nein") || input.equalsIgnoreCase("no")) {
- booleanoutput = false;
- bs = false;
- } else {
- System.out.println("[System] Ungültige Eingabe !");
- }
- }
- return booleanoutput;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement