Building Triangles
From Huben's Wiki
Line 4: | Line 4: | ||
Class Point will have: | Class Point will have: | ||
− | * two double fields, x and y. | + | * two final double fields, x and y. |
* a two argument constructor for setting the fields. | * a two argument constructor for setting the fields. | ||
− | * nobody else should be able to look at or change those variables except with accessor | + | * nobody else should be able to look at or change those variables except with accessor methods (that you must write.) |
* a method named distance() that takes another point as an argument and finds the distance between the two points. | * a method named distance() that takes another point as an argument and finds the distance between the two points. | ||
* a toString() method that has no arguments and returns a String showing the point as a coordinate pair such as (9,3). | * a toString() method that has no arguments and returns a String showing the point as a coordinate pair such as (9,3). |