Advertisement
Guest User

ye

a guest
Jan 26th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1.     public class Exercise05 {
  2.         public static final int NUMBER_OF_ROWS = 4;
  3.         public static final int SEGMENT_HEIGHT = 3;
  4.         public static void main(String[] args) {
  5.             int numberOfRows = NUMBER_OF_ROWS;
  6.             int numberOfSegs = SEGMENT_HEIGHT;
  7.             for (int rowNumber = 0; rowNumber < numberOfRows; rowNumber++) {
  8.                 echoPrint(" ", numberOfRows - rowNumber + 3);
  9.                 echoPrint("*", 2 * rowNumber + 1);
  10.                 System.out.println();
  11.    
  12.             }
  13.             for (int rowNumber = 0; rowNumber < numberOfRows; rowNumber++) {
  14.                 echoPrint(" ", numberOfRows - rowNumber + 2);
  15.                 echoPrint("*", 2 * rowNumber + 3);
  16.                 System.out.println();
  17.             }
  18.         }
  19.    
  20.         public static void echoPrint(String m, int numberOfTimes)
  21.         {
  22.             /* draw the first tree */
  23.             for( int i = 0; i < numberOfTimes; i++) {
  24.                 System.out.print(m);
  25.             }
  26.         }
  27.    
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement