Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java, implement the Point class (basic Point class was discussed in the lecture). The class has the following instance variables: x coordinate * y

image text in transcribed

In Java, implement the Point class (basic Point class was discussed in the lecture). The class has the following instance variables: x coordinate * y coordinate and the following methods Constructor that sets the x and y coordinates Get and set methods * Method equals if this point is equal to another point object (if the x and y coordinates are the same) Method isHigher if this point is higher than another point object (if the y coordinate of this point is greater than the y coordinate of the other point) Method findLength that calculates the length of the line connecting this point to another point object(Formula for length between two points (x1'yl) and (x2y2) is square root of ((x2-x1) (y2-yl)?) Test the class. In the demo program, construct four points pl, p2, p3 and p4 using user-defined values. Determine . Which point is the highest. (If two points are at the same height, you may report either point). . Whether line pl-> p2 is longer than line p3-> p4. A sample screen dialog is given below: Enter the x and y coordinates for pointi: -97 Enter the x and y coordinates for point2: 5 -7 Enter the x and y coordinates for point3: 4 -3 Enter the x and y coordinates for point4: 0 -2 [-9,7] is the highest point The lengthbetween I-9,71 and [5,-7] is 19.79898987322333 The length between [4,-3] and [0,-2] is 4.123105625617661 Line from [-9,7] to [5,-7] is longer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

Students also viewed these Databases questions

Question

Factors Affecting Conflict

Answered: 1 week ago

Question

Describe the factors that lead to productive conflict

Answered: 1 week ago

Question

Understanding Conflict Conflict Triggers

Answered: 1 week ago