Project 1: Java Programming

Triangle Numbers: Using the Boom! program as a model, write a Java Applet that prints the first N triangle numbers to System.out.println.

Triangle Numbers are integers which result by arranging objects in a triangle, such as 1, 3, 6 or 10 objects:

                                        x
                            x          x x
                   x       x x        x x x
          x       x x     x x x      x x x x 

          1        3        6          10

Generate Triangle Numbers as follows:
  1. Set triangleNumber to 0, index to 1.
  2. Increment triangleNumber by index, and then index by 1.
  3. Print triangleNumber and repeat the increment step, if index is less than N.

Copyright 1998 Burton Rosenberg; All rights reserved.