Question: Hi, I am taking java class and i was given this problem can anyone please help? I need help with question 2 not one 1.
Hi, I am taking java class and i was given this problem can anyone please help? I need help with question 2 not one
1. Design and implement a function that takes two parameters of type array of integers, traverses the arrays, and compares if these two arrays are equal (without using the equals method). Two arrays are equal if their size are the same and their elements at same indices are the same.
2. Design and implement a function that takes two parameters of type arrays of Points and compares if these two arrays are equal. Two arrays are equal if their size are the same and their elements at same indices are the same. Two points are the same if their x and y fields are the same.
For comparison of the arrays, similar to task 1, do not use array's equal methods. For comparison of point element do use the equals method. Add and implement equals method to the following class Point that you should use.
class Point{
private int x;
private int y;
int getX() { return x; }
int getY() { return y; }
//add and implement equals method here.
//add and implement any other method you may need.
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
