package eecs1022.finala; /** * This question is worth 5 marks. Partial marks will be awarded for this question. * * @author Franck van Breugel */ public class Question3 { /** * Print the following pattern of the given length. You may assume that the given length * is greater than or equal to 0. * The pattern is: *+*+*+*+*+*+*+*+*+*+*+*... * * @param length the length of string to be printed. */ public static void pattern(int length) { for (int i = 0; i < length; i++) { if (i % 2 == 0) { System.out.print("*"); } else { System.out.print("+"); } } } /** * Tests method. You may add more test cases. * * @param args not applicable. */ public static void main(String[] args) { Question3.pattern(1); Question3.pattern(4); Question3.pattern(9); Question3.pattern(11); Question3.pattern(23); } }