Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Exercise05 {
- public static final int NUMBER_OF_ROWS = 4;
- public static final int SEGMENT_HEIGHT = 3;
- public static void main(String[] args) {
- int numberOfRows = NUMBER_OF_ROWS;
- int numberOfSegs = SEGMENT_HEIGHT;
- for (int rowNumber = 0; rowNumber < numberOfRows; rowNumber++) {
- echoPrint(" ", numberOfRows - rowNumber + 3);
- echoPrint("*", 2 * rowNumber + 1);
- System.out.println();
- }
- for (int rowNumber = 0; rowNumber < numberOfRows; rowNumber++) {
- echoPrint(" ", numberOfRows - rowNumber + 2);
- echoPrint("*", 2 * rowNumber + 3);
- System.out.println();
- }
- }
- public static void echoPrint(String m, int numberOfTimes)
- {
- /* draw the first tree */
- for( int i = 0; i < numberOfTimes; i++) {
- System.out.print(m);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement