On the Line

Problem

Develop a program that, given as input three points P1, P2, and P3 on the Cartesian coordinate plane, reports whether P3 lies on the line through P1 and P2. 

 

Input

The data will be read from a file called line.txt, with the following format:

x1

y1

x2

y2

x3

y3

where x1 and y1 are the coordinates of P1, x2 and y2 are the coordinates of P2, and x3 and y3 are the coordinates of P3. The number of input sets is unknown. Quit when you reach end of file. Create your own sample data.

 

Sample Program Execution:

x1: 12
y1: 5
x2: 7
y2: 9
x3: 10
y3: 7
The point (10,7) IS NOT on the line containing (12,5) and (7,9).

 

x1: 0
y1: 0
x2: -1
y2: -1
x3: 5
y3: 5
The point (5,5) IS on the line containing (0,0) and (-1,-1).

 

Your output format must match the output in the example. Name your program file Linexxx.java where the xxx is your user name. Email the Java source file to me.