CS 1073 Introductory Programming
for Scientific Applications
Homework 3: Print a Tree


Due Date:


Overview: This homework asks you are to print a "tree" shape made up of stars, where the size of the tree can vary. For example, here are several trees of different sizes:

size = 7size = 10size = 15
      *
     ***
    *****
   *******
  *********
 ***********
     ***
     ***
     ***
   *******
         *
        ***
       *****
      *******
     *********
    ***********
   *************
  ***************
 *****************
        ***
        ***
        ***
      *******
              *
             ***
            *****
           *******
          *********
         ***********
        *************
       ***************
      *****************
     *******************
    *********************
   ***********************
  *************************
 ***************************
             ***
             ***
             ***
           *******

General directions:


What to turn in:
  1. Source listings (the Java code) for the program.

  2. Results of runs for trees of sizes 10, 7, 15, and 3.

    Note: You should use netBeans, though it is permissible to use Java from another source. In netBeans, the simplest way to make up the material to print is to just copy from netBeans (using ctrl-C) and paste into Word or WordPad (using ctrl-V). Then print the resulting document. You can assemble all 5 programs into a single document to print.

    In case you have written a program for one part, but it doesn't produce output or doesn't produce the correct output, you should still turn in a listing for part credit.