In InvertedTrianglesWorld,
InvertedTriangleTurtles draw patterns of inverted
equilateral triangles. We can specify the initial size of the
triangle (ie the length of one side) and the number of
triangles to draw. When we create an
InvertedTriangleTurtle tina, she starts at a
specific place with her pen down and facing the right. If we ask her
to draw fewer than one triangle, she does nothing. The first triangle
she draws has its left bottom corner where she starts. Regardless of
the number of triangles she draws, tina stands in her initial
position facing her initial direction when she is finished. The
following pictures illustrate the result from asking tina to
draw different numbers of triangles.
|
|
|
|
|
|
Our task is to fill in the code for the
invertTriangles method in the
InvertedTriangleTurtle class. The following skeleton is
provided for us.
public void invertTriangles (double size, int number) {
System.out.println("invertTriangles("+size+", "+number+");");
// add your code here
}
We may also want to define auxiliary methods in the
InvertedTriangleTurtle class. We should not need to
modify the InvertedTrianglesWorld class in order for our
code to work. However, we may modify it during testing.