Lab 3.1 - Slope Calculator

slope

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!

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 -4.2 -0.10454545454545
6 5 6 -4.2 Undefined

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.