- Ensure each of the test cases in the class TriangleUtilitiesTest successfully passes upon completion of each of the method stubs in the class TriangleUtilities.
String getRow(int width)
String getSmallTriangle()
String getLargeTriangle()
String getTriangle(int n)
- Description
- In the class,
Triangles
Write a method that returns aString
representation of a row of asterisks whose length is equal to thewidth
specified.
- In the class,
-
Sample Script
// : Given int width = 10; // : When String outcome = Triangles.getRow(width); // : Then System.out.println(outcome);
-
Sample Output
**********
- Description
- In the class,
Triangles
Write a method that returns aString
representation of a small triangle, whose base height and base width is 4 asterisks.
- In the class,
-
Sample Script
// : Given // : When String outcome = Triangles.getSmallTriangle(); // : Then System.out.println(outcome);
-
Sample Output
* ** *** ****
- Description
- Write a method that returns a
String
representation of a large triangle, whose base height and base width is 10 asterisks.
- Write a method that returns a
-
Sample Script
// : Given // : When String outcome = Triangles.getLargeTriangle(); // : Then System.out.println(outcome);
-
Sample Output
* ** *** **** ***** ****** ******* ******** *********
- Description
- Given one integer,
n
, generate aString
representation of a triangle whose base height and width is equal ton
.
- Given one integer,
-
Sample Script
// : Given int numberOfRows = 15; // : When String outcome = Triangles.createTriangle(numberOfRows); // : Then System.out.println(outcome);
-
Sample Output
* ** *** **** ***** ****** ******* ******** ********* ********** *********** ************ ************* **************