Question: 5 . 7 . 3 : Modify the boxString method to leave a space around the string. 5 9 3 6 6 0 . 4

5.7.3: Modify the boxString method to leave a space around the string.
593660.4532814. ax3zqy7
Modify the boxstring method to leave a space around the string that is being boxed, like this:
! Hello !
public class BoxStringModification
{
/**
Prints a string in a box.
@param contents the string to enclose in a box
*/
public static void boxString(String contents)
{
int n = contents.length();
* Your code goes here */
System.out.println();
}
public static void main(String[] args)
5.7.4: Use the boxString method to print a line of hyphens.
5.7.4: Use the boxString method to print a line of hyphens.
593660.4532814. qx3zqy7
The boxstring method contains two for loops for printing a line of - characters, one at the top and one at the bottom. Since the
code is the same, place it into a separate method printLine, and use that method to simplify boxstring.
import java.util.Scanner;
public class BoxStringWithHelper
{
/**
Prints a line of hyphens followed by a newline.
@param count the number of - characters to print.
*/
public static /* Your code goes here */
{
/* Your code goes here */
}
/**
Prints a string in a box.
@param contents the string to enclose in a box
5.7.5: Modify the boxString method to print a string in a box with corners.
593660.4532814.93z9y7
Modify the boxstring method so that it prints a + character in the corners:
5 . 7 . 3 : Modify the boxString method to leave

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!