/**
* Get the input from the user
*
* @author (prabu)
* @version (2020/11/9)
*/
import java.util.*;
public class InputReader
{
private Scanner reader;
public InputReader()
{
reader = new Scanner(System.in);
}
/**
* Read an integer input of option in the menu from the user input
*/
public String getOptionInput()
{
System.out.print(">");
String option = reader.nextLine().trim().toLowerCase();
return option;
}
/**
* Read a line of text from standart input (text terminal), and return it
* as a set of words.
*
* @return A set of Strings, where each String is one of the words typed
* by the user
*/
public HashSet<String> getInput()
{
System.out.print(">"); // print prompt
String inputLine = reader.nextLine().trim().toLowerCase();
String[] wordArray = inputLine.split(" ");
// add words from array into hashset
HashSet<String> words = new HashSet<String>();
for(String word: wordArray)
{
words.add(word);
}
return words;
}
}