Scanner console = new Scanner(System.in);
int width = 50* (int)(Math.random()*3+1);
int width2 = 50* (int)(Math.random()*3+1);
int width3 = 50* (int)(Math.random()*3+1);
int width4 = 50* (int)(Math.random()*3+1);
int width5 = 50* (int)(Math.random()*3+1);
int width6 = 50* (int)(Math.random()*3+1);
int height = 50;
triangle1 = new Triangle();
triangle2 = new Triangle();
triangle3 = new Triangle();
trunk1 = new Square();
trunk2 = new Square();
triangle4 = new Triangle();
triangle5 = new Triangle();
triangle6 = new Triangle();
trunk3 = new Square();
trunk4 = new Square();
System.out.println ("Hello, Welcome to terminal.\n");
System.out.println ("This program will draw two trees next to each other where the widths");
System.out.println ("of the triangles on the trees randomly vary between 50,100, and 150");
Crea Smith wrote:I want the whole tree to be one of three sizes everytime I run
I don't understand this requirement. What is the "size" of a tree?
I've run it numerous times, and always get either 50, 100, or 150, which is what I think you want. So can you tell us exactly what is not working?
Crea Smith wrote:The widths of the six triangles that make up the trees should be 50, 100, or 150 pixels, but the height should remain a constant 140 pixels.
So then "int height = 50" doesn't quite agree with that. But all of this discussion seems kind of futile when we don't know what that code is doing. Is it producing some kind of picture?
Please UseCodeTags when you post source code - that way your code will be much easier to read on the forum.
Sorry, I hadn't notice he was a new member. In that case I'll add some code tags
Jesper de Jong wrote:Crea Smith, welcome to the Ranch.
Please UseCodeTags . . .