Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have attached two methods that determine the boolean equality of a 2D and 3D, as well as, two methods that display these results. How

I have attached two methods that determine the boolean equality of a 2D and 3D, as well as, two methods that display these results. How do I go about using the results of the equality() methods to give the correct output in my displayEquality() methods? Thanks for the help, the language is Java.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

* Tests two 3D point objects for equality * @param obj the right operand object ("this" is the left operand) * @return true is the two 30 points are equal, false otherwise @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Point3D other = (Point3D) obj; if (this.z != other.z) { return false; } final Point3D other1 = (Point3D) obj; if (super.x != otheri.x) { return false; } final Point3D other2 = (Point3D) obj; if (super.y != other2.y) { return false; } return true; } * Tests two 2D point objects for equality * @param obj the right operand object ("this" is the left operand) * @return true is the two 20 points are equal, false otherwise */ @Override public boolean equals(Object obj) { if (this obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Point2D other = (Point2D) obj; if (this.x != other.) { return false; } if (this.y != other.y) { return false; } return true; } * Determines the equality of two 20 points. * @param pointOne the first point in the comparison. * @param pointTwo the second point in the comparison. */ public static void displayEquality (Point2D pointOne, Point2D pointTwo) { boolean boolean1; pointTwo.toString() && pointOne.toString() == pointTwo.toString()) if (pointOne.toString() { boolean1 = true; } else { boolean1 = false; } 10 System.out.println("(" + pointOne.toString() + ", + pointOne.toString() + ") == (" + pointTwo.toString() + ", " + pointTwo.toString() + "): " + booleanl); } * Determines the equality of two 3D points. * @param pointOne the first point in the comparison. * @param pointTwo the second point in the comparison. */ public static void display Equality(Point3D pointOne, Point3D pointTwo) { boolean boolean2; if (pointOne.getX() pointTwo.getX() && pointOne.getY() == pointTwo.getY() && pointOne.getz() == pointTwo.get2()) { boolean2 = true; } elsel { boolean2 = false; } System.out.println("(" + pointOne.toString() + ", " + pointOne.toString() + " + pointOne.toString() + ") == (" + pointTwo.toString() + ", " + pointTwo.toString() + pointTwo.toString() + "): " + boolean2); 11 + }

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

ISBN: 1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

3. What might you have done differently?

Answered: 1 week ago