@Override
    protected final String getCommand() {

        Scanner inFile = new Scanner(System.in);
        String command;
        boolean valid = false;
        do {
            
           command = inFile.nextLine(); //gets input
           command = command.trim().toUpperCase(); //changes it to uppercase
           if ("B".equals(command) || "G".equals(command) || "M".equals(command) 
                    || "P".equals(command) || "Q".equals(command)) valid = true;
           else {
                System.out.println("Invalid command. Please enter a valid command.");
                continue;
           } 
        } while (!valid);
        
        return command;
    }