My professor told me these things are wrong:1) For getting the "#" sign in your board, you need to call the createTicTacToeBoard() method to create the board. The returning type of the method is char[][] createTicTacToeBoard() not the string, and you don't need to pass any array into this method as it is the method to create the board. Inside this method, you create the board and assign the "#" sign to each cell, i.e., board [row][column] = (char)35. After the board is created and returned to the main(), you pass the board into the String displayTicTacToeBoard(char[][] board) method that return the enter board as a string back to the main().

2) For the program to finish, you need to have a post-test loop and two variables: win and draw. If someone wins or they draw, you assign true to the win or draw, and then use this statement, while(!draw && !win) to stop the program and then ask the user whether or not they want to have another game.

3) The problem is that the createTicTacToeBoard() method is used to create the initial board. After the board has been created, you don't need to call it again for every user's input as you use the for-loop to keep calling the createTicTacToeBoard() method and keeping appending the variable output at line 45. What you need to do is to create the board outside the for-loop. After that, when the user enters the input, you assign the token to the board based on the inputs and then pass the board to the String displayTicTacToeBoard(char[][] board) method to return the board to the variable output. After then, you pass the variable output to the JOptionPane.showMessageDiaglog to display the board.

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			output += createTicTacToeBoard(board);
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			output += createTicTacToeBoard(board);
			checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			displayTicTacToeBoard(board, output);

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static void displayTicTacToeBoard(char[][] board, String output) {
		JOptionPane.showMessageDialog(null, output, "Lab Assignment 2", JOptionPane.INFORMATION_MESSAGE);
		
	}

	private static String createTicTacToeBoard(char[][] board) {
		String output = "";
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				output = output + ( board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

}

My professor told me these things are wrong:1) For getting the "#" sign in your board, you need to call the createTicTacToeBoard() method to create the board. The returning type of the method is char[][] createTicTacToeBoard() not the string, and you don't need to pass any array into this method as it is the method to create the board. Inside this method, you create the board and assign the "#" sign to each cell, i.e., board [row][column] = (char)35. After the board is created and returned to the main(), you pass the board into the String displayTicTacToeBoard(char[][] board) method that return the enter board as a string back to the main().

2) For the program to finish, you need to have a post-test loop and two variables: win and draw. If someone wins or they draw, you assign true to the win or draw, and then use this statement, while(!draw && !win) to stop the program and then ask the user whether or not they want to have another game.

3) The problem is that the createTicTacToeBoard() method is used to create the initial board. After the board has been created, you don't need to call it again for every user's input as you use the for-loop to keep calling the createTicTacToeBoard() method and keeping appending the variable output at line 45. What you need to do is to create the board outside the for-loop. After that, when the user enters the input, you assign the token to the board based on the inputs and then pass the board to the String displayTicTacToeBoard(char[][] board) method to return the board to the variable output. After then, you pass the variable output to the JOptionPane.showMessageDiaglog to display the board.

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			output += createTicTacToeBoard(board);
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			output += createTicTacToeBoard(board);
			checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			displayTicTacToeBoard(board, output);

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static void displayTicTacToeBoard(char[][] board, String output) {
		JOptionPane.showMessageDialog(null, output, "Lab Assignment 2", JOptionPane.INFORMATION_MESSAGE);
		
	}

	private static String createTicTacToeBoard(char[][] board) {
		String output = "";
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				output = output + ( board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

}

Where is the questions you have on your code, i cant see any :S?

[EDIT]or is your question for us to put the above points you mentioned into more "readable" and "understandable" text?

Edited 4 Years Ago by DavidKroukamp: n/a

Where is the questions you have on your code, i cant see any :S?

I just need help understand what these suggestion mean towards my code:
1) For getting the "#" sign in your board, you need to call the createTicTacToeBoard() method to create the board. The returning type of the method is char[][] createTicTacToeBoard() not the string, and you don't need to pass any array into this method as it is the method to create the board. Inside this method, you create the board and assign the "#" sign to each cell, i.e., board [row][column] = (char)35. After the board is created and returned to the main(), you pass the board into the String displayTicTacToeBoard(char[][] board) method that return the enter board as a string back to the main().

2) For the program to finish, you need to have a post-test loop and two variables: win and draw. If someone wins or they draw, you assign true to the win or draw, and then use this statement, while(!draw && !win) to stop the program and then ask the user whether or not they want to have another game.

3) The problem is that the createTicTacToeBoard() method is used to create the initial board. After the board has been created, you don't need to call it again for every user's input as you use the for-loop to keep calling the createTicTacToeBoard() method and keeping appending the variable output at line 45. What you need to do is to create the board outside the for-loop. After that, when the user enters the input, you assign the token to the board based on the inputs and then pass the board to the String displayTicTacToeBoard(char[][] board) method to return the board to the variable output. After then, you pass the variable output to the JOptionPane.showMessageDiaglog to display the board.

I just need help understand what these suggestion mean towards my code:
1) For getting the "#" sign in your board, you need to call the createTicTacToeBoard() method to create the board. The returning type of the method is char[][] createTicTacToeBoard() not the string, and you don't need to pass any array into this method as it is the method to create the board. Inside this method, you create the board and assign the "#" sign to each cell, i.e., board [row][column] = (char)35. After the board is created and returned to the main(), you pass the board into the String displayTicTacToeBoard(char[][] board) method that return the enter board as a string back to the main().

2) For the program to finish, you need to have a post-test loop and two variables: win and draw. If someone wins or they draw, you assign true to the win or draw, and then use this statement, while(!draw && !win) to stop the program and then ask the user whether or not they want to have another game.

3) The problem is that the createTicTacToeBoard() method is used to create the initial board. After the board has been created, you don't need to call it again for every user's input as you use the for-loop to keep calling the createTicTacToeBoard() method and keeping appending the variable output at line 45. What you need to do is to create the board outside the for-loop. After that, when the user enters the input, you assign the token to the board based on the inputs and then pass the board to the String displayTicTacToeBoard(char[][] board) method to return the board to the variable output. After then, you pass the variable output to the JOptionPane.showMessageDiaglog to display the board.

as far as i understand, The createTicTacToeBoard() should have the skeleton struct of:

private static char[][] createTicTacToeBoard() {//accepts no arguments
char[][] charArray=...; 
//you create the board and assign the "#" sign to each cell
return charArray;//thus it will return a char array
}

the displayTicTacToeBoard(char[][] board) would have the skeleton struct:

private static String displayTicTacToeBoard(char[][] board) {//accepts a multidimensional char array as argument as returned from createTicTacToeBoard
String s=...;
//create string representation of char[][]
return s;//returns the mutli dimensional char array of the board as a string
}

I guess first get that working before you worry about the rest... baby steps

[edit] so basically the code in createBoard should be:

for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				//except here you would add the values to your char array
		}

in your displayboard you would loop through the array and do as you did:

for  (int row = 0; row < board.length; row++){
			for (int i=0;...)
				output = output + ( board [row][column]);
			output = output + ("\n");
		}//now return the string output of the board

Edited 4 Years Ago by DavidKroukamp: n/a

as far as i understand, The createTicTacToeBoard() should have the skeleton struct of:

private static char[][] createTicTacToeBoard() {//accepts no arguments
char[][] charArray=...; 
//you create the board and assign the "#" sign to each cell
return charArray;//thus it will return a char array
}

the displayTicTacToeBoard(char[][] board) would have the skeleton struct:

private static String displayTicTacToeBoard(char[][] board) {//accepts a multidimensional char array as argument as returned from createTicTacToeBoard
String s=...;
//create string representation of char[][]
return s;//returns the mutli dimensional char array of the board as a string
}

I guess first get that working before you worry about the rest... baby steps

[edit] so basically the code in createBoard should be:

for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				//except here you would add the values to your char array
		}

in your displayboard you would loop through the array and do as you did:

for  (int row = 0; row < board.length; row++){
			for (int i=0;...)
				output = output + ( board [row][column]);
			output = output + ("\n");
		}//now return the string output of the board

Ok i made all the changes you suggested

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			output += createTicTacToeBoard(board);
			output += checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			displayTicTacToeBoard(board, output);

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static String displayTicTacToeBoard(char[][] board) {
		for (int row =0; row < board.length; row++){
			for (int i = 0; i < board.length; i++);
			String output = output + (board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

	private static char[][] createTicTacToeBoard(){
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				(board [row][column] = (char)35);
		}
		return board;
	}

}

Ok i made all the changes you suggested

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			output += createTicTacToeBoard(board);
			output += checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			displayTicTacToeBoard(board, output);

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static String displayTicTacToeBoard(char[][] board) {
		for (int row =0; row < board.length; row++){
			for (int i = 0; i < board.length; i++);
			String output = output + (board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

	private static char[][] createTicTacToeBoard(){
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				(board [row][column] = (char)35);
		}
		return board;
	}

}

Now is everything so far working the way you want it to and of course as it should? if so then whats the next problem you are facing with your code...

Now is everything so far working the way you want it to and of course as it should? if so then whats the next problem you are facing with your code...

The code actually wont run at all now

The code actually wont run at all now

because when you change one thing you must change the others that relate to it.... you changed the two methods therefore the calls to the methods and arguments change:

output += createTicTacToeBoard();//passed wrong arguments non were required
            output += checkCoulmn(board, i, player1, player2);
            output += checkRow(board, i, player1, player2);
            //output += checkDiagonal(board, i, player1, player2);
            displayTicTacToeBoard(board);//passed an extra argument when it only accepts 1

also your methods have a lot of errors, i fixed some the rest i commented about:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        for (int row = 0; row < board.length; row++) {
            for (int i = 0; i < board.length; i++);
            output = output + (board[row][column]);//where is column declared in this for loop? and why is there a ';' why not for (int column = 0; column < board.length; column++)
            output = output + ("\n");
        }
        return output;
    }

    private static char[][] createTicTacToeBoard() {
        char[][] board = new char[10][10];//change size for what you need if you dont declare this how must you fill it and return it
        for (int row = 0; row < board.length; row++) {
            for (int column = 0; column < board[row].length; column++) {
                board[row][column] = (char) 35;//why did you have parenthisis surrounding this
            }
        }
        return board;
    }

Edited 4 Years Ago by DavidKroukamp: n/a

because when you change one thing you must change the others that relate to it.... you changed the two methods therefore the calls to the methods and arguments change:

output += createTicTacToeBoard();//passed wrong arguments non were required
            output += checkCoulmn(board, i, player1, player2);
            output += checkRow(board, i, player1, player2);
            //output += checkDiagonal(board, i, player1, player2);
            displayTicTacToeBoard(board);//passed an extra argument when it only accepts 1

also your methods have a lot of errors, i fixed some the rest i commented about:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        for (int row = 0; row < board.length; row++) {
            for (int i = 0; i < board.length; i++);
            output = output + (board[row][column]);//where is column declared in this for loop? and why is there a ';' why not for (int column = 0; column < board.length; column++)
            output = output + ("\n");
        }
        return output;
    }

    private static char[][] createTicTacToeBoard() {
        char[][] board = new char[10][10];//change size for what you need if you dont declare this how must you fill it and return it
        for (int row = 0; row < board.length; row++) {
            for (int column = 0; column < board[row].length; column++) {
                board[row][column] = (char) 35;//why did you have parenthisis surrounding this
            }
        }
        return board;
    }

New code

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			createTicTacToeBoard(i,w);
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			displayTicTacToeBoard(board);
			output += checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static String displayTicTacToeBoard(char[][] board) {
		String output = "";
		int column =0;
		for (int row =0; row < board.length; row++){
			for (int i = 0; i < board.length; i++);
			output = output + (board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

	private static char[][] createTicTacToeBoard(int i, int w){
		i = 0;
		w = 0;
		do{
			String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			i = Integer.parseInt(boardCreator);
			w = i;
			if (i < 0)
			{
				JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
			if (1 == i)
			{
				JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while (i < 2);
		char board [][] = new char [i][w];
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				board [row][column] = (char)35;
		}
		return board;
	}

}

New code

import javax.swing.JOptionPane;


public class ticTacToeGame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int response;
		String player1 = null;
		String player2 = null;
		player1 = createUser1(player1);
		player2 = creatUser2(player2);
		
		do{
			
			
			int i = 0;
			int w = 0;
			do{
				String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
		        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
				i = Integer.parseInt(boardCreator);
				w = i;
				if (i < 0)
				{
					JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
				if (1 == i)
				{
					JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
							"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
				}
			}while (i < 2);
			
			
			char [][] board = new char [i][w];
			
			int arrayLength = i * w;
			//board [i][w] = (char)35;
			createTicTacToeBoard(i,w);
			
			String output = "";
			for(int u = 0; u < arrayLength;){
			u = u + 1;

			String userRowSelection = JOptionPane.showInputDialog(null,"" + output + "\n" + "" + player1 + " (X): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int j = Integer.parseInt(userRowSelection);
			
			String userColumnSelection = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player1 + " (X): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int k = Integer.parseInt(userColumnSelection);
			
			board[j][k] = (char)88;
			u = u + 1;

			String userRowSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the row#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int p = Integer.parseInt(userRowSelection2);
			
			String userColumnSelection2 = JOptionPane.showInputDialog(null, "" + output + "\n" +"" + player2 + " (O): " + "Please enter the column#", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			int o = Integer.parseInt(userColumnSelection2);
			
			board[p][o] = (char)79;
			
			
			
			}
			displayTicTacToeBoard(board);
			output += checkCoulmn(board, i, player1, player2);
			output += checkRow(board, i, player1, player2);
			//output += checkDiagonal(board, i, player1, player2);
			

			response = JOptionPane.showConfirmDialog(null, "Play another game?", 
					"Lab Assignment 1", JOptionPane.YES_NO_OPTION);

		}while (response != 1);
		


	}

	private static String checkDiagonal(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX = true;
		int row = 0, column = 0;
		while(row < i && column < i && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allX = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allX){
			if (board[row][column] != (char)88)
				allX = false;
			else {
				row++;
				column++;
			}
		};
		if (allX)
			JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		boolean allO = true;
		row = 0; column = 0;
		while(row < i && column < i && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		
		allO = true;
		row = 0; column = 2;
		while(row < 3 && column >= 0 && allO){
			if (board[row][column] != (char)79)
				allO = false;
			else {
				row++;
				column++;
			}
		};
		if (allO)
			JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
		return output;
	}

	private static String checkCoulmn(char[][] board, int i, String player1,
			String player2) {
		String output ="";
		boolean allX;
		for (int column = 0; column < i; column++){
			int row = 0; allX = true;
			while(row < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					row++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		
		boolean allO;
		for (int column = 0; column < i; column++){
			int row = 0; allO = true;
			while(row < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					row++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);

			}
		}
		return output;
	}

	private static String checkRow(char[][] board, int i, String player1, String player2) {
		String output = "";
		boolean allX;
		for (int row = 0; row < i; row++){
			int column = 0; allX = true;
			while(column < i && allX){
				if (board[row][column] != (char)88)
					allX = false;
				else
					column++;
			};
			
			if (allX){
				JOptionPane.showMessageDialog(null,"" + (player1) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		boolean allO;
		for (int row = 0; row < i; row++){
			int column = 0; allO = true;
			while(column < i && allO){
				if (board[row][column] != (char)79)
					allO = false;
				else
					column++;
			};
			
			if (allO){
				JOptionPane.showMessageDialog(null,"" + (player2) + ", You win","Take-Home Assignment 2",JOptionPane.INFORMATION_MESSAGE);
			}
		}
		return output;
	}

	private static String creatUser2(String player2) {
		do{
		player2 = JOptionPane.showInputDialog(null, "Please enter your name, Player 2: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			if(player2.isEmpty()){
				JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while(player2.isEmpty());
		return player2;
	}

	private static String createUser1(String player1) {
		do{
		player1 = JOptionPane.showInputDialog(null, "Please enter your name, Player 1: ", 
        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
		if(player1.isEmpty()){
			JOptionPane.showMessageDialog(null, "Sorry! Your name is empty. " +
					"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
		}
		}while(player1.isEmpty());
		return player1;
	}

	private static String displayTicTacToeBoard(char[][] board) {
		String output = "";
		int column =0;
		for (int row =0; row < board.length; row++){
			for (int i = 0; i < board.length; i++);
			output = output + (board [row][column]);
			output = output + ("\n");
		}
		return output;
	}

	private static char[][] createTicTacToeBoard(int i, int w){
		i = 0;
		w = 0;
		do{
			String boardCreator = JOptionPane.showInputDialog(null, "Please enter the size of your game board?", 
	        		"Take-Home Assignment 1", JOptionPane.QUESTION_MESSAGE);
			i = Integer.parseInt(boardCreator);
			w = i;
			if (i < 0)
			{
				JOptionPane.showMessageDialog(null, "Sorry! Please enter a positive number. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
			if (1 == i)
			{
				JOptionPane.showMessageDialog(null, "Sorry! The size of the board cannot be less than 2 x 2. " +
						"Please enter again.", "Take-Home Assignment 1", JOptionPane.ERROR_MESSAGE);
			}
		}while (i < 2);
		char board [][] = new char [i][w];
		for  (int row = 0; row < board.length; row++){
			for (int column = 0; column < board[row].length; column++)
				board [row][column] = (char)35;
		}
		return board;
	}

}

stiill this error:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        int column = 0;
        for (int row = 0; row < board.length; row++) {
            for (int i = 0; i < board.length; i++);//you have an empty for statement
            output = output + (board[row][column]);
            output = output + ("\n");
        }
        return output;
    }

i would think it would need to be:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        for (int row = 0; row < board.length; row++) {
            for (int column = 0; column < board.length; column++)  {
            output = output + (board[row][column]);
            output = output + ("\n");
            }
        }
        return output;
    }

and once you have fixed this see if your codes working correctly up until now, is your board being created correctly how does the string output of the board look... use some println's once you've done that and seen whats happening then only can you begin to even think of coding the rest...well my opinion

stiill this error:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        int column = 0;
        for (int row = 0; row < board.length; row++) {
            for (int i = 0; i < board.length; i++);//you have an empty for statement
            output = output + (board[row][column]);
            output = output + ("\n");
        }
        return output;
    }

i would think it would need to be:

private static String displayTicTacToeBoard(char[][] board) {
        String output = "";
        for (int row = 0; row < board.length; row++) {
            for (int column = 0; column < board.length; column++)  {
            output = output + (board[row][column]);
            output = output + ("\n");
            }
        }
        return output;
    }

and once you have fixed this see if your codes working correctly up until now, is your board being created correctly how does the string output of the board look... use some println's once you've done that and seen whats happening then only can you begin to even think of coding the rest...well my opinion

it seems to function right but now the code makes an entire line equal to O and X and if a line is composed of both X and O then line goes blank.

it seems to function right but now the code makes an entire line equal to O and X and if a line is composed of both X and O then line goes blank.

Well then thats the first thing you need to fix, use print statements to find out where things are going wrong in your code... and then only can i help you fix it, because i cant fix it if you dont even know where its going wrong

This article has been dead for over six months. Start a new discussion instead.