// Variation of the Diamond1 program that uses a constant to allow for resizing // the diamond output and that introduces methods to capture structure. public class Diamond2 { public static final int SIZE = 8; public static void main(String[] args) { upTriangle(); downTriangle(); } public static void upTriangle() { for (int row = 0; row < SIZE; row++) { for (int i = 0; i < SIZE - 1 - row; i++) { System.out.print(" "); } System.out.print("/"); for (int i = 0; i < 2 * row; i++) { System.out.print("."); } System.out.println("\\"); } } public static void downTriangle() { for (int row = SIZE - 1; row >= 0; row--) { for (int i = 0; i < SIZE - 1 - row; i++) { System.out.print(" "); } System.out.print("\\"); for (int i = 0; i < 2 * row; i++) { System.out.print("."); } System.out.println("/"); } } }