- Ensure each of the test cases in the class TriangleUtilitiesTest.
String getRow(int width)String getSmallTriangle()String getLargeTriangle()String getTriangle(int n)
- Description
- In the class,
TrianglesWrite a method that returns aStringrepresentation of a row of asterisks whose length is equal to thewidthspecified.
- 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,
TrianglesWrite a method that returns aStringrepresentation 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
Stringrepresentation 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 aStringrepresentation 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
* ** *** **** ***** ****** ******* ******** ********* ********** *********** ************ ************* **************