Pārlūkot izejas kodu

interim changes2

Donna Jacobs 6 gadus atpakaļ
vecāks
revīzija
10fd9b7c6f
1 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. 14
    3
      TriangleUtilities.java

+ 14
- 3
TriangleUtilities.java Parādīt failu

@@ -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