To accomplish this project you will need the
Point class. I supplied you with
Point.class, which is the Byte Code version of Point.java.
Steps to get the Point class working with your
Project:
READ THE
DIRECTIONS CAREFULLY
1) Download Point.class
2) You need to create a new folder named proj3File, anywhere you want and place Point.class in that folder.
3) Go
to NETBEANs
4) RIGHT CLICK on your project.
5) Go
to properties
6) A
new window should appear. On the left,
click on Libraries.
7) Then
on the right, click on Add JAR/Folder
8) Find
the proj3File folder you created earlier and press open.
9) Then
press ok.
Everything
should be ready to go.
10)
Create a file named LastNameProj3.java,
where LastName is YOUR Last Name.
11) You
should declare and instantiate a Point object by using 1 of the 2 Constructors below.
You
can type
Point
x = new Point(); //This calls the Default Point Constructor
Or
Point
x = new Point(3,2); //This calls the parameterized
Point constructor which allows you to make any point you want.
12)
System.out.println() your point to make sure that it is working. If you see the point then it is working.
13) You
can delete the 2 lines you just wrote and start the project.
___________________________________________________________________________________________________________
Point Class API
This class represents a Point on the xy
coordiate plane (x, y). I chose to make
x and y doubles in case you want to use the Midpoint formula in your proofs.
Constructor
Summary |
|
Point() default Point Constructor the
constructor initializes the newly created Point by setting it to the point
(5.0, 5.0) |
|
Point(double x, double y) parameterized Point
constructor the constructor initialize the x-coordinate to x and the
y-coordinate to y |
|
Method
Summary |
|
|
public boolean |
equals(Point anotherPoint) equals -- this method returns
true if this Point is equal to anotherPoint, otherwise it returns false |
||
public double |
getX() getX method -- this method
returns the x-coordinate of a Point |
||
public double |
getY() getY method -- this method
returns the y-coordinate of a Point |
||
public String |
toString() toString method -- this
method returns the state of the Point object |
||
toString
public String toString()
toString method -- this method returns the state of the Point
object
Overrides:
toString in class java.lang.Object
Returns:
a String in the format of (x, y)
public double getX()
getX method -- this method returns the x-coordinate of a Point
Returns:
the x-coordinate of a Point
public double getY()
getY method -- this method returns the y-coordinate of a Point
Returns:
the y-coordinate of a Point
public boolean equals(Point anotherPoint)
equals -- this method returns true if this Point is equal to
anotherPoint, otherwise it returns false
Parameters:
anotherPoint - a point to compare this Point to
Returns:
true if the Points are equal, false otherwise
Get Free Quote!
438 Experts Online