Question: Programming language Java 1- Create a class called Point that includes two instance variables as follows: An x coordinate and a y coordinate of type
Programming language Java
1- Create a class called Point that includes two instance variables as follows: An x coordinate and a y coordinate of type integers, which are defined as private.
A) Write two constructors for this class as follows: A default constructor that sets the instance variables to zero and a constructor that receives values for the instance variables as parameters and sets them.
B) Write the set and get methods for the Point class to set and return the values of it instance variables, respectively.
C) Write a toString() method for the Point class that prints the class name (Point) and the value of its instance variables.
D) Write a copy constructor for the Point class.
E) Write an equals() method for the Point class that returns true if both x and y coordinates of the two points are equal, otherwise it returns false.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
