ARTICLE AD BOX
I was looking to see how some one else would have approached this coding problem.
One of my assignments was to print a string within a box that contains 4 plus signs in the corner.
+-----+ !Hello! +-----+Here is the following code I used:
/* Top Row */ System.out.print("+"); for (int i = 0; i < n; i++) { System.out.print("-"); } System.out.println("+"); System.out.println("!" + contents + "!"); /* Bottom Row */ System.out.print("+"); for (int i = 0; i < n; i++) { System.out.print("-"); } System.out.println("+");I feel the code appears pretty bloated, is there a more simpler way someone would have done this?
