瀏覽代碼

interim changes2

Donna Jacobs 6 年之前
父節點
當前提交
10fd9b7c6f
共有 1 個文件被更改,包括 14 次插入3 次删除
  1. 14
    3
      TriangleUtilities.java

+ 14
- 3
TriangleUtilities.java 查看文件

@@ -3,12 +3,23 @@
3 3
 public class TriangleUtilities {
4 4
 
5 5
     public static String getRow(int numberOfStars) {
6
-        
7
-        return null;
6
+        String star = "*";
7
+        String output = "";
8
+        int n = numberOfStars;
9
+        for(int i =1; i<=n; i++) {
10
+            output = String.format("%s", star);
11
+        }
12
+        return output;
8 13
     }
9 14
     
10 15
     public static String getTriangle(int numberOfRows) {
11
-        return null;
16
+        String star = "*";
17
+        String output = "";
18
+        int n = numberOfRows;
19
+        for(int i =1; i<=n; i++) {
20
+            output += String.format("%s", star);
21
+        }
22
+        return output;
12 23
     }
13 24
 
14 25