Class SumOfMetersAboveSeaLevel

java.lang.Object
commandManagers.Command
commandManagers.commands.SumOfMetersAboveSeaLevel
All Implemented Interfaces:
CommandInterface

public class SumOfMetersAboveSeaLevel extends Command
Command class for computing the sum of meters above sea level of all cities in the collection.
  • Constructor Details

    • SumOfMetersAboveSeaLevel

      public SumOfMetersAboveSeaLevel()
  • Method Details

    • getName

      public String getName()
      Description copied from class: Command
      Base method for show command name
      Specified by:
      getName in interface CommandInterface
      Specified by:
      getName in class Command
      Returns:
      command name
    • getDescr

      public String getDescr()
      Description copied from class: Command
      Base method for show command description.
      Specified by:
      getDescr in interface CommandInterface
      Specified by:
      getDescr in class Command
      Returns:
      command description
    • execute

      public void execute()
      Computes the sum of meters above sea level of all cities in the collection and prints it to the console.
      Specified by:
      execute in interface CommandInterface
      Specified by:
      execute in class Command
    • checkArgument

      public boolean checkArgument(Object inputArgument)
      Checks if the input argument is null, and returns true if it is, or false and prints an error message otherwise.
      Specified by:
      checkArgument in interface CommandInterface
      Specified by:
      checkArgument in class Command
      Parameters:
      inputArgument - the argument to check
      Returns:
      true if the input argument is null, false otherwise