Java OOP GUIDE / WORK POINT CLASS 2 Topics
TASK –
PART 1 – CONSIDER THE FOLLOWING POINT CLASS Copy the
following Point class into your IDE:
|
|
TASK – PART 2 – TESTING
THE POINT CLASS Create
another class called PointTester and follow the
following steps:
TASK – PART 3 – ADDING A
NEW METHOD Create a new
method also called distanceFrom that gets a Point object as
parameter. It should calculate the
distance between the Point you are in (this) to the Point parameter. TASK – PART 4 – MORE
TESTING Inside the
main function from Part 2, test your new method on p1 to determine its
distance from p2. Do vice versa as
well. Output your results. TASK – PART 5 – PROCESSING
A POINT ARRAY Copy the
following code to your IDE and add the statements needed to calculate and
output the perimeter of the polygon that is contained in the array of points.
|