/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pointtest; /** * class Point represents a point in the 1st quadrant of the * Cartesian plane * @author jcmtiernan */ public class Point { private int x; private int y; public Point(int x, int y) { if (x >= 0) { this.x = x; } else {this.x = 0; } if (y>=0) {this.y = y; } else { this.y = 0;} } public Point() { this.x = 0; this.y = 0; } public boolean setX(int x) { if (x >= 0) { this.x = x; return true; } else { this.x = 0; return false; } } public void setY(int y) { this.y = y; } @Override public String toString() { return String.format("("+x+","+y+")"); } }