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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:40, almaga1979orfvwo
5. illustrate how fine-line inventory classification can be used with product and market segments. what are the benefits and considerations when classifying inventory by product, market, and product/market?
Answers: 2
image
Computers and Technology, 22.06.2019 14:40, Kathryn014
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
image
Computers and Technology, 22.06.2019 21:30, elsauceomotho
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, valeriegarcia12
Select the correct answer from each drop-down menu. which types of computer networks are bigger as well as smaller than a man? a man is a network of computers that covers an area bigger than a , but smaller than a .
Answers: 1
You know the right answer?
Implement the compare method of the following class rectanglecomparator. the method compares two rec...

Questions in other subjects:

Konu
Mathematics, 06.03.2020 19:06