public String getPlayersName() {
        boolean valid = false; // indicates if the name has been retrieved
        String playersName = null;
        Scanner keyboard = new Scanner(System.in); // keyboard input stream

        while (!valid) { // while a valid name has not been retrieved

            // prompt for the player's name
            System.out.println("Enter the player's name below:");

            // get the name from the keyboard and trim off the blanks
            playersName = keyboard.nextLine();
            playersName = playersName.trim();

            if (playersName.toUpperCase().equals("Q")) { // Quitting?
                return null;
            }

            // if the name is invalid (non-blank and < two characters)
            if (playersName.length() < 2) {
                // display an error
                System.out.println("Invalid name - the name must be non blank "
                        + "and greater than one character in length");
            } else {
                valid = true; // signal that a valid name was entered
            }
        }

        return playersName; // return the name
    }