Class MessageApp

Object
MessageApp

public class MessageApp extends Object
This is the heart of the program, providing interaction between the client and the MessageList. As such, it needs an ArrayList of Messages to work.
  • Field Details

  • Constructor Details

    • MessageApp

      public MessageApp(ArrayList<OpenMessage> messages)
      Initialize the ArrayList of messages
      Parameters:
      messages - ArrayList of messages
  • Method Details

    • go

      public void go()
      Runs the program, keep going until user input is "x". If "x" is entered, stop the program.
    • processCommand

      public void processCommand(String command)
      Checks the command (options from the menu) and calls appropriate methods for its functionality. Does nothing if a command is not known (no need for help dialog).

      Implementation Hints:

      • First convert the command to lower case so we don't have to worry about case
      • Then check if the command is "s". If so, search for the string and print the result.
      • Use helper methods! The searchHelper() method is there to keep clutter out of the processCommand() method.
      • Note: You will need to print the results of searchHelper()
      Parameters:
      command - command entered by user
    • searchHelper

      private String searchHelper()
      Asks user for what type of search and what they are searching for, then returns the message if found.
      Returns:
      String that is a list of all messages found that satisfy the search