The slope of a line is equal to the quotent of the rise and the run, which is to say something like (Y2 - Y1) / (X2 - X1). This number is rarely an integer, so it's useful to have a quick and easy way of calculating it.

Create an application that takes the X and Y coordinates of two points on a line and displays the slope in decimal form.

Look! It's a bird! It's a plane! It's an object list!

- Four Text Boxes: one each for the X1 and Y1 coordinates, and the X2 and Y2 coordinates. Make sure each has a Label so the user knows what they are.
- A Button to do the calculations. Take the values from the Text Boxes and plug them into the formula.
- A Label to display the results (with a Label to indicate that it's for the results).

**WARNING:** Remember that a vertical line (one where both
points' X-coordinates are the same) has no slope. The computer will give you a bad answer if it tries to divide by zero, so make sure your program checks for that before telling it to
divide by (X2 - X1); the computer will have to make a decision about whether it can do the division before actually doing it. If your answer is "NaN" or "Infinity" or "-Infinity" then you're doing it wrong. **Do not allow the computer to divide by zero,** even if VB translates the answer into something it can understand.

Here's sample data and answers that you should get:

X1 | Y1 | X2 | Y2 | Result |
---|---|---|---|---|

8 | 6 | 12 | 18 | 3 |

-3 | 5 | 85 | -42 | -0.534090909090909 |

6 | -3 | 6 | 19 | Undefined |

- Common mistakes include:
- Not setting the TextAlign property to Right in TextBoxes intended for numeric input.
- Not checking the input to avoid dividing by zero.
- Losing track of which TextBox goes with which variable.
- Losing track of which Label goes with which TextBox.
- Using global scope when you should be using local scope.
- Letting the computer divide by zero at any point.
- Not leaving enough space to display the full result.
- Wasting real estate or cutting off the title of the program.

**OPTION:** Come up with a method to also display the answer as a fraction. The fraction must be an improper fraction in lowest terms.
Five tokens to the first player who figures it out.

As always, design a useful and proper interface.