In class, we wrote a program that printed a picture of a mirror with a size
of 4. We are going to complete the program (that means completing
bottomHalf
and line
and rewriting the program so that the mirror has a size of
3. You will find the original partial program below:
public class Mirror { public static void main(String[] args) { line(); topHalf(); bottomHalf(); line(); } // Prints the expanding pattern of <> for the // top half of the figure. public static void topHalf() { for (int line = 1; line <= 4; line++) { System.out.print("|"); for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } System.out.print("<>"); for (int dot = 1; dot <= (line * 4 - 4); dot++) { System.out.print("."); } System.out.print("<>"); for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } System.out.println("|"); } } static void bottomHalf() { for (int line = 1; line <= 4; line++) { // contents of each line } public static void line() { // ... } }