141k views
0 votes
The organizers of the chess tournament find it difficult to write in the black squares of the printed chessboard. They want you to change the program in the "problem-Solving Case Study" at the end of chapter 2, so that the black squares have a blank space in their center that is four characters wide and two lines high. (Hint: You may have to define another string constant.)

User LoganMzz
by
8.0k points

1 Answer

4 votes

Final answer:

To change the program in the "problem-Solving Case Study" at the end of chapter 2, so that the black squares on the chessboard have a blank space in their center, define a string constant to represent the two lines of space. Incorporate this string constant into the program to print the black squares with the desired blank space.

Step-by-step explanation:

To change the program in the "problem-Solving Case Study" at the end of chapter 2 so that the black squares on the chessboard have a blank space in their center, you will need to define another string constant. This new string constant should represent the two lines of space, which could be composed of a combination of newline characters (\\) and blank spaces. By incorporating this string constant into the program, you can ensure that the black squares have a four-character wide and two-line high blank space in their center. Here's an example of how you could define this string constant:

String blankSpace = "\\\\ ";

By using this string constant, you can modify the program to print the black squares with the desired blank space in their center.

User Adam Thompson
by
8.3k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.