1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
-
- public class TriangleUtilities {
-
- public static String getRow(int numberOfStars) {
- String answer = "";
- for(int i=0; i < numberOfStars; i++){
-
- answer = answer.concat("*");
-
- }
-
- return answer;
- }
-
- public static String getTriangle(int numberOfRows) {
- String answer = "";
- for(int i=0; i < numberOfRows;i++){
- for(int j=0; j <= i; j++){
- answer = answer.concat("*");
- }
- answer = answer.concat("\n");
- }
-
- return answer;
- }
-
-
- public static String getSmallTriangle() {
- String answer = "";
- for(int i=0; i < 4;i++){
- for(int j=0; j <= i; j++){
- answer = answer.concat("*");
- }
- answer = answer.concat("\n");
- }
-
- return answer;
- }
-
- public static String getLargeTriangle() {
- String answer = "";
- for(int i=0; i < 9;i++){
- for(int j=0; j <= i; j++){
- answer = answer.concat("*");
- }
- answer = answer.concat("\n");
- }
-
- return answer;
- }
- }
|