troubles with Vector2D

I wonder why does this not compile?

it says, Vector2D[] cannot be resolved or is not a type. ;(

thanks!

// Rect.java

import java.io.*;

public class Rect

{

public static Vector2D getPoint(int i)

throws IOException

{String s;

float x = 0.0f, y = 0.0f;

BufferedReader in = new BufferedReader

(new InputStreamReader(System.in));

System.out.print("x"+i+"= "); System.out.flush();

s = in.readLine();

x = Float.parseFloat(s);

System.out.print("y"+i+"= "); System.out.flush();

s = in.readLine();// read keyboard input as string

y = Float.parseFloat(s);

return new Vector2D(x,y);

}

public static void main(String[] args)

throws IOException

{int i;

System.out.println("Enter vertices 0, 1, 2, 3");

Vector2D[] point = new Vector2D[4];

for ( i = 0; i < 4; i++)

point = getPoint(i);

for ( i = 0; i < 4; i++)

System.out.print(point + " ");

Vector2D v;

Vector2D u = point[1].minus(point[0]);

for ( i = 0; i < 3; i++)

{ v = point[(i+2)%4].minus(point[i+1]);

if ( ! u.isPerpendicular(v) )

{System.out.println("No, not a rectangle.");

return;

}

u = v;

}

System.out.println("Yes, a rectangle.");

}

}

[1365 byte] By [frayfraya] at [2007-11-26 16:46:48]
# 1
Enclose code in [code] tags.
DrLaszloJamfa at 2007-7-8 23:14:15 > top of Java-index,Java Essentials,New To Java...
# 2

import java.io.*;

public class Rect

{

public static Vector2D getPoint(int i)

throws IOException

{ String s;

float x = 0.0f, y = 0.0f;

BufferedReader in = new BufferedReader

(new InputStreamReader(System.in));

System.out.print("x"+i+"= "); System.out.flush();

s = in.readLine();

x = Float.parseFloat(s);

System.out.print("y"+i+"= "); System.out.flush();

s = in.readLine(); // read keyboard input as string

y = Float.parseFloat(s);

return new Vector2D(x,y);

}

public static void main(String[] args)

throws IOException

{ int i;

System.out.println("Enter vertices 0, 1, 2, 3");

Vector2D[] point = new Vector2D[4];

for ( i = 0; i < 4; i++)

point = getPoint(i);

for ( i = 0; i < 4; i++)

System.out.print(point + " ");

Vector2D v;

Vector2D u = point[1].minus(point[0]);

for ( i = 0; i < 3; i++)

{ v = point[(i+2)%4].minus(point[i+1]);

if ( ! u.isPerpendicular(v) )

{ System.out.println("No, not a rectangle.");

return;

}

u = v;

}

System.out.println("Yes, a rectangle.");

}

}

frayfraya at 2007-7-8 23:14:15 > top of Java-index,Java Essentials,New To Java...
# 3
Do you define Vector2D?
DrLaszloJamfa at 2007-7-8 23:14:15 > top of Java-index,Java Essentials,New To Java...