Esempio n. 1
0
  /*
  Method: wordSearchMenu - user interface
  Purpose: word menu, interacts with user and calls database methods
              to search for user input, prints out search results
  Parameters:
      Database currentThesaurus   the database parsed from the text file
  Returns:
      none
  */
  public static void wordSearchMenu(Database currentThesaurus) {
    // basic menu for simple text input
    // should work for any normal circumstances
    System.out.println("\nPlease type the word to be searched for");
    System.out.print(">> ");
    // Scanner to take user input
    Scanner inputScanner = new Scanner(System.in);
    // the word being searched for
    String userInput = inputScanner.nextLine();

    // searches the database for a word

    String returnString = currentThesaurus.searchForWord(userInput);
    // the results of the search
    System.out.println(returnString + "\n");
  }