<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// modified version of http://homepage.cs.uiowa.edu/~sriram/21/spring07/code/Point.java

import java.util.*;

// A class to represent points in the Euclidean plane

public class Point {
  
  public double x;
  public double y;
  
  public Point(double newX, double newY) 
  {
    x = newX;
    y = newY;
  }
  
  
  // A constructor that constructs a randomly generated
  // point both of whose coordinates are the range 0 through d,
  // where d is a given integer parameter. Since each coordinate
  // is generated uniformly at random in the range 0 through d,
  // the result is a point that is dropped uniformly at random
  // in a d by d square
  public Point (int d)
  {
    // Random is a class in java.util
    Random rand = new Random();
    
    //nextDouble(), a method in the Random class
    //returns a random double in the range 0 through 1
    x = d*rand.nextFloat();
    y = d*rand.nextFloat();
  }
  
  public void prtPoint()
  {
    System.out.println("x = " + x + " y = " + y);
  }
  
  
  public String toString()
  {
    return "x = " + x + " y = " + y;
  }
  
  
  // main()
  public static void main(String[] args) {
    
    
    for(int i=0;i&lt;100;i++) {
      Point p = new Point(100);
      
      p.prtPoint();
    }// next
    
  }// main()
  
}// Point

</pre></body></html>