Hello,
My assignment is to create a christmas tree using methods with defined parameters.
1) Print the tree at position 50 (50 spaces in)
2) Call the following Triangle (2,6) (six rows without the first 2 printed)
3) and the 1st row of these cut off triangles with the symbol @
4) Using the same principles create a rectangle as the trunk, and a space at the top of the tree to the top of the window
I have this much done, but I have NO idea what I'm supposed to do next, or how to go about it. Any help would be great.
// This program uses methods to recreate the christmas
// tree program
public class newTree
{
public static void main(String[] args)
{
Rectangle();
Triangle();
Triangle();
Triangle();
Rectangle();
}
public static void Triangle(int start, int height)
{
// Code to print a triangle
int i, j,l;
String str;
str="@@@#####BHHA&Gh93X25Sisr;,." ;
l=str.length()-1;
for (i=0;i<10;i++)
{
for(j=0;j<50-i;j++)
System.out.print(' ');
for(j=0;j<2*i+1;j++)
System.out.print(str.charAt( (int) ( Math.round(l*j/(2*i+1.0))) ) );
System.out.println();
}
}
public static void Rectangle(int height, int width)
{
// Code for rectangle
int i,j;
for (i=0;i<10;i++)
{
for(j=0;j<5;j++)
System.out.print('*');
System.out.println();
}
}
}