Reference no: EM132151610
Text Boxes
Write and test several overloaded methods called textBoxString. This method returns a String value.
public static String textBoxString (int side)
The returned String value, when printed, displays as a square of side characters. The character you use is up to you. Don't forget that '\n' will force a newline character into the returned String. For example, let's assume I want to use * as the character for my box:
String s = textBoxString(3); System.out.println(s);
will print
*** *** ***
public static String textBoxString(int side, char bChar)
The returned String value, when printed, displays as a square of side characters using bChar as the box character. For example,
String s = textBoxString(4, '+'); System.out.println(s);
will print
++++
++++
++++
++++
public static String textBoxString(int rows, int cols)
The returned String value, when printed, displays as a rectangle of rows rows and cols columns using your default box character.
String s = textBoxString(3, 4); System.out.println(s);
will print
****
****
****
public static String textBoxString(int rows, int cols, char c1, char c2)
The returned String value, when printed, displays a rectangle of rows rows and cols columns using alternating c1 and c2 characters.
String s = textBoxString(3, 5, 'x', 'o'); System.out.println(s);
will print
xoxox
oxoxo
xoxox