String getRow(int width)
Triangles
Write a method that returns a String
representation of a row of asterisks whose length is equal to the width
specified.
Sample Script
// : Given
int width = 10;
// : When
String outcome = Triangles.getRow(width);
// : Then
System.out.println(outcome);
Sample Output
**********
String getSmallTriangle()
Triangles
Write a method that returns a String
representation of a small triangle, whose base height and base width is 4 asterisks.
Sample Script
// : Given
// : When
String outcome = Triangles.getSmallTriangle();
// : Then
System.out.println(outcome);
Sample Output
*
**
***
****
String getLargeTriangle()
String
representation of a large triangle, whose base height and base width is 10 asterisks.
Sample Script
// : Given
// : When
String outcome = Triangles.getLargeTriangle();
// : Then
System.out.println(outcome);
Sample Output
*
**
***
****
*****
******
*******
********
*********
String getTriangle(int n)
n
, generate a String
representation of a triangle whose base height and width is equal to n
.
Sample Script
// : Given
int numberOfRows = 15;
// : When
String outcome = Triangles.createTriangle(numberOfRows);
// : Then
System.out.println(outcome);
Sample Output
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************