subject

Implement the compare method of the following class rectanglecomparator. the method compares two rectangles. the method should return:

a positive integer if the area of the first rectangle is larger than the area of the second rectangle

a negative integer if the area of the first rectangle is smaller than the area of the second rectangle

0 if the two rectangles have the same area.

import java. util. comparator;

import java. awt. rectangle;

public class rectanglecomparator implements comparator

`{

/**

compares two rectangle objects.

@param r1 the first rectangle

@param r2 the second rectangle

@return 1 if the area of the first rectangle is larger than the area of

the second rectangle, -1 if the area of the first rectangle is smaller than the area of the second rectangle or 0 if the two

rectangles have the same area

*/

public int compare(rectangle r1, rectangle r2)

{



}

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
How can you know if the person or organization providing the information has the credentials and knowledge to speak on this topic? one clue is the type of web site it is--the domain name ".org" tells you that this site is run by a nonprofit organization.
Answers: 2
question
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Awell-diversified portfolio needs about 20-25 stocks from different categories is this true or false?
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
You know the right answer?
Implement the compare method of the following class rectanglecomparator. the method compares two rec...
Questions
question
Mathematics, 19.08.2019 22:50
question
Biology, 19.08.2019 22:50
question
Mathematics, 19.08.2019 22:50
question
Mathematics, 19.08.2019 22:50