Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(IN JAVA): Within the method, max, in the class Coordinates.java ensure that the return type (new Coordinates object) has an x value which is the

(IN JAVA): Within the method, max, in the class Coordinates.java ensure that the return type (new Coordinates object) has an x value which is the maximum of this point's x and coordinate's x, and a y value which is the maximum of this point's y and coordinate's y. do not change the original Coordinates objects. For example: Coordinate c1 = new Coordinate( 10, 0 );

Coordinate c2 = new Coordinate( 20, -10 );

c1.max( c2 ); // returns a Coordinate at ( 20.0, 0.00 )

Given

----------------------------------------------------------------------

public class Coordinates { private double x; private double y; public Coordinates( double x, double y ) { this.x = x; this.y = y; } public Object max(Coordinates p) { //enter code here } public String toString(){ return String.format("(%.2f, %.2f)", x, y); } }

----------------------------------------------------------------------

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions