import java.awt.*; // Imports some tools that Java provides for us // specifically, things like Colors. public class MyPicture extends BasicPicture { // declares our new class // "extends BasicPicture" means that you inherit all the functions of Basic // Picture class that we designed. This provides you with things // like drawLine() and nextColor(...) public MyPicture() {}; // This makes a constructor for our new class // although this constructor does nothing, Java requires we have it // even if we never use it. public MyPicture(Color c, int x, int y, int size, int angle, Info info) { // There are 2 important things here: // This is the constructor you will be calling when you say // MyPicture UpperRightH = new MyPicture(blah blah blah); // to create the smaller H's // the values that you use in the new MyPicture() call will be // the values available to the smaller H when it attempts to draw itself int nX, nY; currentColor = c; // most of this silliness is needed for rotation, dont worry about it currentX = info.x; currentY = info.y; nX = newX(x,y,info.angle); nY = newY(x,y,info.angle); currentX = nX; currentY = nY; currentSize = size; currentAngle = angle; currentPen = info.g; currentInfo = new Info(currentX,currentY,currentAngle,currentSize,info.g); } /************************************************************************** * The Draw method does the actual drawing of the current H * it also must create new smaller H's and tell them to draw themselves * (These smaller H's will in turn create even smaller H's inside their * draw method, and so on until the screen is full of H's) **************************************************************************/ public void draw() { // ^ // | // | // | // All of your code goes right here between these 2 {}'s // You code should do something like this: // Draw the H at the correct position using the correct size // (see the figure in the lab for help with this) // And then create 4 smaller H objects at the correct position // and size. Tell these 4 new H's to draw themselves. // the minimum code you need should be: 3 drawLines(), 4 new MyPicture(), // 4 draw(), and one if to keep the recursion from going on forever. // | // | // | // V } // End of the draw method } // End of the MyPicture class