Question: Question 2 (10 marks): Design a class named Point that meets the following requirements: Two data fields w and z for representing a point with

 Question 2 (10 marks): Design a class named Point that meets

Question 2 (10 marks): Design a class named Point that meets the following requirements: Two data fields w and z for representing a point with getter methods. A no-arg constructor that constructs a point for (0,0). A constructor that constructs a point with the specified w and z values. Override the equals method. Point pl is said to be greater than point p2 if pl.w = = p2.w and pl.z = = p2.z. Implement the Comparable interface and the compare Tomethod. Point pl is said to be greater than point p2 if pl.w > p2.w or if pl.w = = p2.w and pl.z >p2.z. Override the toString() method to return a string as (w value, z value]. Implement the Cloneable interface and clone method. . Page 2 of 4 Complete and run your program using the following code: public class Ques_02 { public static void main(String[] args) { Point pl = new Point(3, 4); Point p2 = new Point(3.4, 1.4); System.out.println(p1.equals(p2)); System.out.println(pl.equals(p1)); System.out.println(pl.compareTo(p2)); System.out.println(p2.compareTo(pl)); Point p3 = (Point) (p1.clone(); System.out.println(p3.equals(p1)); System.out.println(p3); } } Submission Follow these instructions carefully or you risk penalties up to 100% of your grade! You are to submit 3 files for each question, separately: 2 1. The Java project that contains assignment 2. A text or word processed document containing all of your source code 3. A text file (.txt) of the output using the "Save to File button from the Console (output window). 1. Java Project: . Your project file should ONLY contain the files needed for this current assignment. It should NOT contain any other projects or files. Your project must be a valid Java project. No other project types will be accepted. . 2. Document of Source: You must also copy and paste all of your source code from both of your classes into a plain text file(e.g. .TXT) or Word document (e.g. .DOC/.DOCX). Page 3 of 4

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!