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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started