Example #1
0
  public void helpDefine(String word, Scanner input) {
    action(word, input);
    int indice = Arrays.asList(this.help).indexOf(word.toLowerCase());
    if (indice == -1) {
      System.out.println("\n");
      System.out.println("Not found, please check your spelling or add word to bank.");
      System.out.println("Use a / followed by a help function to use.");
      System.out.println("Enter a help function to be defined: ");
      helpDefine(input.nextLine(), input);
    }

    System.out.println("\n");
    System.out.println(help[indice]);
    System.out.println("----------------------");
    System.out.println(helpDef[indice]);
  }
Example #2
0
 public void action(String word, Scanner input) {
   if (word.equalsIgnoreCase("/switch") || word.equalsIgnoreCase("/s")) {
     try {
       super.chooseBank();
     } catch (FileNotFoundException e) {
       // Handle the exception
     }
   } else if (word.equalsIgnoreCase("/quit") || word.equalsIgnoreCase("/q")) {
     quit();
   } else if (word.equalsIgnoreCase("/bank")) {
     getBank();
     define(input);
   } else if (word.equalsIgnoreCase("/add")) {
     addDef(file);
   } else if (word.equalsIgnoreCase("/help") || word.equalsIgnoreCase("/?")) {
     getHelp();
     System.out.println("\n");
     System.out.println("Enter a help function to be defined: ");
     helpDefine(input.nextLine(), input);
     define(input);
     // Update Comment
   }
 }