title: How to write a java program to make a "cloud" of random dots?
body: <p>I'm having a lot of trouble with this one program and I was wondering if anyone could tell me what I'm doing wrong... Here's the prompt: 
  Implement a class Cloud that contains an array list of Point2D.Double objects. Support methods</p>
  
  <pre><code>public void add(Point2D.Double aPoint)
  public void draw (Graphics2D g2)
  </code></pre>
  
  <p>Draw each point as a tiny circle. Write a graphical application that draws a cloud of 100 random points. </p>
  
  <p>Here's what I have, but it won't actually do anything, I'm just really confused and I could use any help!</p>
  
  <p>Cloud.java:</p>
  
  <pre><code>import java.awt.*;
  import java.util.*;
  import java.awt.geom.Point2D;
  import java.awt.geom.Ellipse2D;
  
  public class Cloud {    
      public void draw(Graphics2D g)
      {
          Random rand = new Random();
          Graphics2D g2 = (Graphics2D) g;
          for (int i=0;i&lt;=20;i++)
          {
              this.add(new Point2D.Double(rand.nextInt(400)+1,rand.nextInt(300)+1));
          }
          for (int i=0; i&lt;list.size();i++) 
          {
              Ellipse2D.Double circle = new         Ellipse2D.Double(list.get(i).getX()-5,list.get(i).getY()-5, 10, 10);
              g2.draw(circle);
          }
      }
      public void add(Point2D.Double aPoint)
      {
          list.add(aPoint);
      }
  
      private ArrayList&lt;Point2D.Double&gt; list = new ArrayList&lt;Point2D.Double&gt;();
  }
  </code></pre>
  
  <p>CloudTest.java:</p>
  
  <pre><code>import java.applet.Applet;
  import java.awt.*;
  import java.awt.geom.Point2D;
  import java.util.*;
  
  public class CloudTest extends Applet
  {
      public void paint(Graphics2D g)
      {
          Graphics2D g1 = (Graphics2D) g;
          Cloud myCloud = new Cloud();
          myCloud.draw(g1);
      }
  }
  </code></pre>