Modify the draw method in the Square class in Figure 8.13a . Instead of prompting the user

Question:

  1. Modify the draw method in the Square class in Figure 8.13a. Instead of prompting the user for border or solid, the draw method should prompt the user for an interior character and a border character. If the user enters a space for the interior character, the result will look like a border square. If the user enters the same character for both the interior and the border, the result will look like a solid square. If the user enters different characters, the border will look different from the interior. Your new draw method must do all the work of the original draw, drawBorderSquare, drawSolidSquare, drawHorizontalLine, and drawSides methods in Figures 8.13a and 8.13b. That means the drawBorderSquare, drawSolidSquare, drawHorizontalLine, and drawSides methods will be unnecessary.

Sample session: Enter width of desired square: 6 Area = 36 Enter middle symbol: 0 Enter border symbol: #

Figure 8.13a:

/******** * Square.java Dean & Dean * *This class manages squares. ************** import java.util. Scanner;

  1. Figure 8.13b:

//* ********* private void drawBorder Square () ( drawHorizontalLine(); 3 // end drawBorder Square

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: