Question: Please complete parts a, b and c. Input file names are provided at the bottom (you don't need to know the information within each input

Please complete parts a, b and c. Input file names are provided at the bottom (you don't need to know the information within each input file all you need to do is input the txt files where appropriate). Programming language is java.

Please complete parts a, b and c. Input file names are provided

at the bottom (you don't need to know the information within each

input file all you need to do is input the txt files

where appropriate). Programming language is java. PointArray Part b: Write a class

PointArray Part b: Write a class called PointArray to represent an array of Point objects containing the following variables and methods: 1. Private data field: points an array of type Point; 2. Public constructors: a constructor that takes an array of doubles containing the x and y values of each point consecutively. That is, if we have the following array of doubles: (2.4, 3.5, 4.7, 1.0, 6.4, 11.01) then we can construct the array of three points: (new Point(2.4, 3.5), new Point(4.7, 1.0), new Point(6.4, 11.01)} Note: this constructor should only accept arrays of even length. a constructor that takes an argument of type FileInputStream, and constructs the points array by reading a text file containing the points. For example, if the file has the following content: 3 24 3.5-10 17 then the first number is the number of points, and below it, each line is a point with x being the first number and y being the second. So we can read the first number in the file to construct a points array of that size, then loop through the file to construct each new Point and store it into the points array. 3. Public methods boolean contains3collinear(): returns true if a PointArray contains three points which are collinear. For example, the points Po: (xnyo), P1: (xy), and P: 2 (x272) are collinear if the slope between Po and P, is the same as the slope between P, and Py: void sort(): sorts the invoking PointArray object using selection sort: the sort is by the ascending order specified by the less than method from the Point class above; boolean equals(PointArray anotherPointArray) : returns true if the invoking PointArray is equal to the argument PointArray. Two arrays of points are equal if all the points are the same. Note: order does not matter for equality: String toString(): returns the string representation of a PointArray. For example, a PointArray with 3 points Po: (xo.yu), Ph: (x1.yt), and P2: (x2.72) would be printed as follows: {(x0, y0), (x1, y1), (x2,y2)). Testing Part c: In a class called PointArrayTester, write a main method to test each of your constructors and methods from the PointArray class. Make at least three distinct PointArray objects and one non-distinct (to test the equals method). To test the constructor that takes a FileInputStream argument, download some of my test files from the Canvas assignment page. Note: if you wish you may pass in the test files to main as command line arguments, however this is not required. Important: Please follow the API provided above. That is, use the method names and signatures as provided. I will be testing your code automatically with my own test files and classes. fivePoints.txt ninePoints.txt eightyPoints.txt B PointArray Part b: Write a class called PointArray to represent an array of Point objects containing the following variables and methods: 1. Private data field: points an array of type Point; 2. Public constructors: a constructor that takes an array of doubles containing the x and y values of each point consecutively. That is, if we have the following array of doubles: (2.4, 3.5, 4.7, 1.0, 6.4, 11.01) then we can construct the array of three points: (new Point(2.4, 3.5), new Point(4.7, 1.0), new Point(6.4, 11.01)} Note: this constructor should only accept arrays of even length. a constructor that takes an argument of type FileInputStream, and constructs the points array by reading a text file containing the points. For example, if the file has the following content: 3 24 3.5-10 17 then the first number is the number of points, and below it, each line is a point with x being the first number and y being the second. So we can read the first number in the file to construct a points array of that size, then loop through the file to construct each new Point and store it into the points array. 3. Public methods boolean contains3collinear(): returns true if a PointArray contains three points which are collinear. For example, the points Po: (xnyo), P1: (xy), and P: 2 (x272) are collinear if the slope between Po and P, is the same as the slope between P, and Py: void sort(): sorts the invoking PointArray object using selection sort: the sort is by the ascending order specified by the less than method from the Point class above; boolean equals(PointArray anotherPointArray) : returns true if the invoking PointArray is equal to the argument PointArray. Two arrays of points are equal if all the points are the same. Note: order does not matter for equality: String toString(): returns the string representation of a PointArray. For example, a PointArray with 3 points Po: (xo.yu), Ph: (x1.yt), and P2: (x2.72) would be printed as follows: {(x0, y0), (x1, y1), (x2,y2)). Testing Part c: In a class called PointArrayTester, write a main method to test each of your constructors and methods from the PointArray class. Make at least three distinct PointArray objects and one non-distinct (to test the equals method). To test the constructor that takes a FileInputStream argument, download some of my test files from the Canvas assignment page. Note: if you wish you may pass in the test files to main as command line arguments, however this is not required. Important: Please follow the API provided above. That is, use the method names and signatures as provided. I will be testing your code automatically with my own test files and classes. fivePoints.txt ninePoints.txt eightyPoints.txt B

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!