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

Complete the printTicTacToe method with char parameters horizChar and vertChar t

ID: 3757906 • Letter: C

Question

Complete the printTicTacToe method with char parameters horizChar and vertChar that prints a tic-tac-toe board with the characters as follows. End with newline. Ex: printTicTacToe('~', '!') prints:

Hint: To ensure printing of characters, start your print statement as: System.out.println("" + horizChar ...).

import java.util.Scanner;

public class GameBoardPrinter {
public static void printTicTacToe(char horizChar, char vertChar) {

/* Your solution goes here */

return;
}

public static void main (String [] args) {
printTicTacToe('~', '!');

return;
}
}

Explanation / Answer

package mani;
import java.util.Scanner;
public class GameBoardPrinter {
public static void printTicTacToe(char horizChar, char vertChar) {
  
   System.out.println("x"+vertChar+"x"+vertChar+"x"+vertChar);
   System.out.println(horizChar+""+horizChar+""+horizChar+""+horizChar+""+horizChar);
   System.out.println("x"+vertChar+"x"+vertChar+"x"+vertChar);
   System.out.println(horizChar+""+horizChar+""+horizChar+""+horizChar+""+horizChar);
   System.out.println("x"+vertChar+"x"+vertChar+"x"+vertChar);
  
return;
}
public static void main (String [] args) {
printTicTacToe('~', '!');
return;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote