// Arup Guha
// 5/25/2010
// Solution to 2010 AP Free Response Question #2

public class APLine {
	
	private int a;
	private int b;
	private int c;
	
	// They are just testing if you know which order to put these.
	public APLine(int aVal, int bVal, int cVal) {
		a = aVal;
		b = bVal;
		c = cVal;
	}
	
	// Just make sure you return a double. I force this by
	// multiplying by 1.0 in the beginning.
	public double getSlope() {
		return -1.0*a/b;
	}
	
	// Uhhh, they sort of tell you exactly how to do this.
	public boolean isOnLine(int x, int y) {
		return a*x + b*y + c == 0;
	}
	
	// Their tests are here...
	public static void main(String[] args) {
		
		APLine line1 = new APLine(5, 4, -17);
		double slope1 = line1.getSlope();
		boolean onLine1 = line1.isOnLine(5, -2);
		System.out.println("slope line 1 = "+slope1+" (5,-2) on line = "+onLine1);
		
		APLine line2 = new APLine(-25, 40, 30);
		double slope2 = line2.getSlope();
		boolean onLine2 = line2.isOnLine(5, -2);
		System.out.println("slope line 2 = "+slope2+" (5,-2) on line = "+onLine2);
		
	}
}