package eecs1022.finala; /** * This question is worth 2.5 marks. No partial marks will be awarded for this question. * * @author Franck van Breugel */ public class Question4 { /** * Prints Z of the given height. You may assume that the height is at least 3. * See test for sample outputs. * * @param height the height of the Z. */ public static void z(int height) { for (int r = 0; r < height; r++) { for (int c = 0; c < height; c++) { if (r == 0 || r == height - 1 || r + c == height - 1) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } /** * Tests method. You may add more test cases. * * @param args not applicable. */ public static void main(String[] args) { Question4.z(3); System.out.println(); Question4.z(4); System.out.println(); Question4.z(5); System.out.println(); Question4.z(6); System.out.println(); Question4.z(7); System.out.println(); } }