All pastes #742225 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-19 10:41 UTC
rendered paste body
/**
 * This class draws a simple house.
 *
 * This class was written as an early example for teaching Java with BlueJ.
 
 
 */
public class DrawHouse
{
  //HARRY - change
  Circle sun;

  /**
  * Draw a House.
  */
  public void drawHouse()
  {
    // Create the local variables needed
    Square wall;
    Square window;
    Triangle roof;
    //Circle sun; - HARRY - commented this out. move it to be within the class, not this method
    int wallSize = 100;
    
    wall = new Square();
    wall.moveVertical(80);
    wall.changeSize(wallSize);
    wall.makeVisible();
    
    roof = new Triangle();  
    roof.changeSize((wallSize/2), (wallSize+40));
    roof.moveHorizontal(60);
    roof.moveVertical(70);
    roof.makeVisible();
    
    window = new Square();
    window.changeColour(Colour.BLACK);
    window.moveHorizontal(20);
    window.moveVertical(100);
    window.makeVisible();
    
    //Circle poo = new Circle(); 
// HARRY - because it is in the class, not this function, we need to get it from the class. the current instance of the class is always 'this'
    this.sun = new Circle() ;
    this.sun.changeColour(Colour.RED);
    this.sun.moveHorizontal(180);
    this.sun.moveVertical(-10);
    this.sun.changeSize(60);
    this.sun.makeVisible();
  //  sun.slowMoveVertical(150);
    
      
    //sun = new Circle();
    //sun.changeColour(Colour.YELLOW);
    //sun.moveHorizontal(0);
    //sun.moveVertical(-10);
    //sun.changeSize(60);
    //sun.makeVisible();
    


  }
    
  
     public void slowMoveVertical()
    { 
        
    //Circle sun;
      
   // sun = Circle();
    //sun.changeColour(Colour.RED);
    //sun.moveHorizontal(180);
    //sun.moveVertical(-10);
    //sun.changeSize(60);
    //sun.makeVisible();
//HARRY - using 'this' again
    this.sun.slowMoveVertical(150);
    }   

}