title: Java Square Class
body: <p>Here is what I am asked to do:
  1.  Create a class called Square that takes a width parameter in the constructor.  The Square class should have a draw() method that will draw the square on the screen.  Create a class called TestSquare that will take width from the user, create an object of Square, and invoke the draw() method on the square object.</p>
  
  <p>Here is what I have, but the problem I am having is passing the draw() method to the test method. I know see that I need to move the for loops from the test to the class, so that i can call it in the test main method.</p>
  
  <pre><code>public class Square {
      /** the width of square*/
      int width;
  
      /** construct the square*/
      Square(){   
      }
  
      /**construct a square */
      Square(int newWidth){
          width = newWidth;
  }
  
  /**show the square*/
    void draw(){
    for (int i=0; i&lt;width; i++)
    {
     for (int j=0; j&lt;width; j++)
     {    System.out.print("* ");}
  
     System.out.println();
    }
  
  }
  }
  import java.util.Scanner;
  
  public class TestSquare {
    /** Main method */
    public static void main(String[] args) {
    // Create a scanner input
   Scanner input = new Scanner(System.in); 
  
    // prompt user to enter width
  System.out.println("Creating a Square ...");
      System.out.print("Please enter its width:");
      int width = input.nextInt();
  
  
     Square square = new Square(width);
     System.out.println("Here is the Square:"); 
     square.draw();
  
  
  
    }
  
  }
  </code></pre>