Question: JAVA HELP 2-dimensional arrays: Add the specified methods to the LetterPuzzle class and add tester code to the main method: checkRow checkColumn scramble test code
JAVA HELP 2-dimensional arrays: Add the specified methods to the LetterPuzzle class and add tester code to the main method: checkRow checkColumn scramble test code in main
Add user interaction to the program. The goal of the puzzle is to arrange the letters so that no two rows and no two columns contain any duplicates. Write a method or set of methods to allow a user to play the game
*****MAIN CLASS******* public static void main (String [] args) { LetterPuzzle puzz = new LetterPuzzle(); System.out.println(puzz); // Add code here to test your methods & display results }
****LetterPuzzle****** import java.util.*;
public class LetterPuzzle { private char [][] puzzle; private char [] letters; public static Random rg = new Random(); /** * Default constructor: creates 4x4 puzzle using first 4 * letters of English alphabet */ public LetterPuzzle() { puzzle = new char[4][4]; letters = new char[4]; for (int x=0; x return true; } /** ********** NEED HELP*************** * Checks for duplicates in a column * @param col is the column to be checked: must be a value 0 .. puzzle.length * @return false if there are duplicates, true if not * @throws IllegalArgumentException if row is out of bounds */ public boolean checkColumn(int col) { return false; } /** * ********NEED HELP************** * Scrambles puzzle so that letters appear in random order */ public void scramble() { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
