## Class LinearEquation

```java.lang.Object
LinearEquation
```

public class LinearEquation
extends Object

A LinearEquation models equations of the form y = mx + b.

Version:
2

 Constructor Summary ```LinearEquation(double m, double b)```           Construct a LinearEquation from a slope and y-intercept. ```LinearEquation(double x1, double y1, double x2, double y2)```           Construct a LinearEquation from two points.

 Method Summary ` double` `compute(double x)`           Compute y, given x. ` LinearEquation` `getInverse()`           Compute the inverse of this linear equation.

 Methods inherited from class java.lang.Object `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

 Constructor Detail

### LinearEquation

```public LinearEquation(double m,
double b)```
Construct a LinearEquation from a slope and y-intercept.

Parameters:
`m` - the slope.
`b` - the y-intercept.

### LinearEquation

```public LinearEquation(double x1,
double y1,
double x2,
double y2)```
Construct a LinearEquation from two points.

Parameters:
`x1` - the x coordinate of the first point
`y1` - the y coordinate of the first point
`x2` - the x coordinate of the second point
`y2` - the y coordinate of the second point
 Method Detail

### compute

`public double compute(double x)`
Compute y, given x.

Parameters:
`x` - the input value.
Returns:
the corresponding value of y: mx+b.

### getInverse

`public LinearEquation getInverse()`
Compute the inverse of this linear equation.

Returns:
the LinearEquation object you get by "solving for x".