Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

private boardPiece[][] pboard = {{new boardPiece(),new boardPiece(),new boardPie

ID: 3557004 • Letter: P

Question

private boardPiece[][] pboard =
       {{new boardPiece(),new boardPiece(),new boardPiece(),
           new boardPiece(),new boardPiece(),new boardPiece()},
          
           {new boardPiece(),new boardPiece(),new boardPiece(),
               new boardPiece(),new boardPiece(),new boardPiece()},
              
           {new boardPiece(),new boardPiece(),new boardPiece(),
               new boardPiece(),new boardPiece(),new boardPiece()},
              
           {new boardPiece(),new boardPiece(),new boardPiece(),
               new boardPiece(),new boardPiece(),new boardPiece()},
                  
           {new boardPiece(),new boardPiece(),new boardPiece(),
               new boardPiece(),new boardPiece(),new boardPiece()},
                      
           {new boardPiece(),new boardPiece(),new boardPiece(),
               new boardPiece(),new boardPiece(),new boardPiece()}};
----------------------------------------------------------------

I believe the array should start something like this:

private boardPiece[][] pboard = new boardPiece[10][10]

Explanation / Answer

import java.util.*;

/* This program implements the word guessing game called Hangman. */

public class Hangman

{

///////////////////////////////////////////////////////////

// 1. CLASS VARIABLE

///////////////////////////////////////////////////////////

private static String[] words = // choose secret word from these

     { "geography", "cat", "yesterday", "java", "truck", "opportunity", "fish