Question: E9.19 Write a method public static Measurable maximum(Measurable[] objects) that returns the object with the largest measure. Use that method to determine the country with

E9.19 Write a method

public static Measurable maximum(Measurable[] objects)

that returns the object with the largest measure. Use that method to determine the country with the largest area from an array of countries.

E9.20 Add static methods largest and smallest to the Measurable interface. The methods should return the object with the largest or smallest measure from an array of Measurable objects.

E9.21 In the Sequence interface of Worked Example 9.2, add static methods that yield Sequence instances:

static Sequence multiplesOf(int n) static Sequence powersOf(int n)

For example, Sequence.powersOf(2) should return the same sequence as the SquareSequence class in the worked example. E9.22 In Worked Example 9.2, add a default method

default int[] values(int n)

that yields an array of the first n values of the sequence.

E9.23 In Worked Example 9.2, make the process method a default method of the Sequence interface.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!