Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a. Your task is to print a string in a box, like this: [He110! Ilowever, different strings can be substituted for IIcllo A method for
a. Your task is to print a string in a box, like this: [He110! Ilowever, different strings can be substituted for IIcllo A method for this task can be declarcd as follows: public static void boxstring(String contents) Now you develop the body of the method in the usual way, by formulating a general method for solving the task. Print a line that contains the - character n+2 times, where n is the length of the string. Print a line containing the enutents, surrounded with a ! to the left and right. Prist another line containing the - character n+2 times. Note that this method performs some actions and then returns to the caller: Because there is no return value, you cannot use boxstring in an expression. You can call boxstring ("Hel10"); but not result = boxstring ("Hello"); // Error:boxstring doesn't-return a result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started