|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreeresponse2010.APLine
public class APLine
Encapsulates a line of the form ax + by + c = 0, where a, b
and c are integers, and a and b are non-zero. This is a sample solution to
free response question #2 on the AP Computer Science 2010 exam.
| Field Summary | |
|---|---|
private int |
aaa_
Coefficient for the x term in ax + by + c = 0. |
private int |
bbb_
Coefficient for the y term in ax + by + c = 0. |
private int |
ccc_
c term in ax + by + c = 0. |
| Constructor Summary | |
|---|---|
APLine(int aaa,
int bbb,
int ccc)
Constructs an object representing a line in the form ax + by = c. |
|
| Method Summary | |
|---|---|
double |
getSlope()
Gets the slope of the encapsulated line. |
boolean |
isOnLine(int xco,
int yco)
Determines whether a point is on the encapsulated line. |
java.lang.String |
toString()
Returns a string representation of the encapsulated line. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int aaa_
ax + by + c = 0.
private int bbb_
ax + by + c = 0.
private int ccc_
ax + by + c = 0.
| Constructor Detail |
|---|
public APLine(int aaa,
int bbb,
int ccc)
ax + by = c.
aaa - Coefficient for the x term in ax + by + c = 0.bbb - Coefficient for the x term in ax + by + c = 0.ccc - c term in ax + by + c = 0.
| Method Detail |
|---|
public double getSlope()
public boolean isOnLine(int xco,
int yco)
xco - x coordinate of point to test.yco - y-coordinate of point to test.
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||