The APLine
problem from the 2010 AP Computer Science Exam is unusually easy. The problem requires you to write a simple class in response to a prompt that contains client code.
APLine
is #2 from the 2010 AP Computer Science Free Response.
https://secure-media.collegeboard.org/apc/ap10_frq_computer_science_a.pdf
APLine
class
public class APLine
{
private int a, b, c;
public APLine(int a, int b, int c)
{
this.a = a;
this.b = b;
this.c = c;
}
public double getSlope()
{
return -(a / ((double) b));
}
public boolean isOnLine(int x, int y)
{
return a * x + b * y + c == 0;
}
}
See Class writing order for a technique to respond to AP CS FR that request an entire class.