package eecs1022.finalc; /** * This question is worth 2.5 marks. No partial marks will be awarded for this question. * * @author Franck van Breugel */ public class Question4 { /** * Prints H of the given height. You may assume that the height is at least 3 * and that height is odd. See test for sample outputs. * * @param height the height of the H. */ public static void h(int height) { for (int r = 0; r < height; r++) { for (int c = 0; c < height; c++) { if (c == 0 || c == height - 1 || r == height / 2) { 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.h(3); System.out.println(); Question4.h(5); System.out.println(); Question4.h(7); System.out.println(); } }