Advertisement
advictoriam

Untitled

Mar 4th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. public class LabeledPoint
  2. {
  3.    private double x;
  4.    private double y;
  5.    private String label;
  6.  
  7.    /**
  8.       Constructs a labeled point with a given position and label.
  9.       @param anX the x-coordinate of the point
  10.       @param aY the y-coordinate of the point
  11.       @param aLabel the label of the point
  12.    */
  13.    public LabeledPoint(double anX, double aY, String aLabel)
  14.    {
  15.       x = anX;
  16.       y = aY;
  17.       label = aLabel;
  18.    }
  19.    
  20.    public String toString()
  21.    {
  22.       return String.format("LabeledPoint[x=%.1f,y=%.1f,label=%s]", x, y, label);
  23.    }
  24.  
  25.    public static String check(double x, double y, String s)
  26.    {
  27.       LabeledPoint lp = new LabeledPoint(x, y, s);
  28.       return lp.toString();
  29.    }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement