diff --git a/week1.java b/week1.java index 7544330..d8b1bc4 100644 --- a/week1.java +++ b/week1.java @@ -311,6 +311,7 @@ class Lab6 extends Lab { - for even-sized triangles, preceding number of spaces starts at n=rows and decrements - for even-sized triangles even numbers have odd spaces and vice versa */ + System.out.println(String.format("")); int spaces = num; for (int i = 1; i <= num; i++) { System.out.println(" ".repeat(spaces) @@ -319,14 +320,26 @@ class Lab6 extends Lab { ); spaces--; } + System.out.println(String.format("")); } + /** + * @param num The number to write the times table for + * @param limit How many multiples to show + */ public void writeTimesTable(int num, int limit) { for (int i = 0; i < (limit + 1); i++) { System.out.printf("%d\t", num * i); } } + /* TOASK - overload example. + Question: is there a better way of doing optional function parameters in java? + */ + /** + * Write times table for num (10 entries) + * @param num Number to show times table for + */ public void writeTimesTable(int num) { int DEFAULT_LIMIT = 10; writeTimesTable(num, DEFAULT_LIMIT);