Java求助帖,学校作业,求助大佬们
标题
In this assignment, you will create the Shape and Point classes to answer questions about a Shape that is made up of a collection of points from the x-y plane, as shown in this lesson. The shape is defined by drawing a line between two adjacent points, for every pair of adjacent points, and also a line between the first and last point.
Create class Point
This class must contain two fields with x and y
Create constructor that accepts two arguments x and y
Create setter and getter functions for x and y
Create function distance that accepts another point and return distance between two points
Create class Shape
This class must contain field points that stores all points of the shape
Create addPoint function that accepts a Point and add it to a field points
Create getPoints that return points
Create calculatePerimeter function that calculate perimeter of the shape
Create function that returns that longest side of the shape
Create function that returns average length of all sides
Create class AssignmentOne, read all points from the file
Create objects of Point and Shape classes
Check every function from Point and Shape classes
points:
file1.txt
-3, 9
-8, 7
-12, 4
-6, -2
-4, -6
2, -8
6, -5
10, -3
8, 5
4, 8
file2.txt
-4, -3
4, -2
12, 2
6, 5
-3, 3
-8, 1