SlopeApplet

Class to demonstrate the calculations associated with the slope of a line.

Applet Parameters:

xrange double..double (default = 0.0..1.0)
Ex. <param name="xrange" value="-5.0..5.0">
x-value range
yrange double..double (default = 0.0..1.0)
Ex. <param name="yrange" value="-5.0..5.0">
y-value range
showformula boolean true/false (default = false)
Ex. <param name="showformula" value="true">
determines whether or not the slope formula is displayed
showequation boolean true/false (default = false)
Ex. <param name="showequation" value="true">
determines whether or not the equation of the line is displayed
slope double (default = 1.0)
Ex. <param name="slope" value="2.0">
Initial slope of the line
yintercept double (default = 0.0)
Ex. <param name="yintercept" value="1.0">
Initial y-intercept of the line
secondline String parallel/perpendicular/userdefined/none (default = none)
Ex. <param name="secondline" value="parallel">
Sets whether a second line exists, and if so, what type it should be
none = no second line
parallel = second line will always be parallel to the first, location set by user clicks
perpendicular = second line will always be perpendicular to the first, location set by user clicks
userdefined = second line is defined by slope/y-intercept or by two points, independent of the first line
slope2 double (default = 1.0)
Ex. <param name="slope2" value="2.0">
Initial slope of the second line
Only used if secondline=userdefined
yintercept2 double (default = 0.0)
Ex. <param name="yintercept" value="1.0">
Initial y-intercept of the second y-intercept
Only used if secondline=userdefined
showtitle boolean (default=false)
Ex. <param name="showtitle" value="true">
If true, the title "Slope=Change in y / Change in x =Rise/Run" will appear at the top of the applet.

Public Constants:

None

Public Methods:

public void setSlope(String m)
Sets the slope of the first line
public void setYIntercept(String b)
Sets the y-intercept of the first line
public void setSlope(String m, int which)
Sets the slope of the "which" line
public void setYIntercept(String b, int which)
Sets the y-intercept of the "which" line
public void setPoints(String X1,String Y1,String X2,String Y2)
Sets the first line by giving two coordinates on the line
public void setPoints(String X1,String Y1,String X2,String Y2,int which)
Sets the "which" line by giving two coordinates on the line
public void showFormula(boolean show)
Turns the formula on/off
corresponds to the "showformula" parameter
public void setSecondLine(String which)
Sets the type of SecondLine
none = no second line
parallel = second line will always be parallel to the first, location set by user clicks
perpendicular = second line will always be perpendicular to the first, location set by user clicks
userdefined = second line is defined by slope/y-intercept or by two points, independent of the first line
corresponds to the "secondline" parameter
public boolean infSlope(int which)
Returns whether the "which" line has infinite slope (i.e. the line is vertical)
public boolean isSlope(double m, int which)
Returns whether the "which" line has a slope = "m"
public boolean isYInter(double b, int which)
Returns whether the "which" line has a y-intercept = "b"
public boolean intersects(double x, double y, int which )
Returns whether the "which" line passes through the point (x,y)
public double getSlope(int which)
Returns the slope of the "which" line
public double getYIntercept(int which)
Returns the y-intercept of the "which" line