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

Printing a grid. Write a program that prints the following grid to play tic-tac-

ID: 3544290 • Letter: P

Question

Printing a grid. Write a program that prints the following grid to play tic-tac-toe.

+--+--+--+

| | | |

+--+--+--+

| | | |

+--+--+--+

| | | |

+--+--+--+

(sorry for weird formatting, but the veritcal lines are supposed match up with the plus signs so it forms a sort of rectangular 'grid')


Of course, you could simply write seven statements of the form

System.out.println("+--+--+--+");

You should do it the smart way, though. Declare string variables to hold two kinds of patterns: a comb-shaped pattern and the bottom line. Print the comb three times and the bottom line once


Any help would be greatly appreciated. Again, this is the java programming language :)

Explanation / Answer

please rate - thanks


not sure this is what you want

import java.util.*;
public class main
{public static void main(String args[])
{String line="+--+--+--+ ";
String comb="| | | | ";
String TTT=line+comb+line+comb+line+comb+line;
System.out.print(TTT);
}

}


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