Question: Study the attached files (Country java, Data.java, Measurable.java and MeasurableTester.java) and then implement a method public static Measurable max(Measurablel] objects) in the Data class that

Study the attached files (Country java, Data.java, Measurable.java and MeasurableTester.java) and then implement a method public static Measurable max(Measurablel] objects) in the Data class that returns the object with the largest measure. Your implementation should not change nor break the attached MeasurableTester class. public class Data Conpute the average of the neasurea of the given objeea eparam objects an array of Measurable objects ereturn the average of the measurea publie atatic double average(Meaaurabl objects) double um0 or Neasurable obj objects) public class Country implements Neasurable private string name private double area; sum-sunobj.getNeasure) if (objects.length 0) Construet a country with nane and area. eparan nane country's nane paran area total area of country return sun objects.length elsc public Country(String nane, double area) return 0 this.nane name this.areaarea Conpute8 the naxinum of the neasures of the given objects Measurable interface method to retrieve neasure return the measured area param objects an array of Measurable objects ereturn the maxinun of the neasure, null if array is empty public double getNeasure) publie static Measurable max(Measurablell objectsy This program demonstrates the neasurable Country class public class MeasurableTeater public static void main(String[ 1 args) Measurable countriesnew Measurablel 3i countries0new Country( "Uruguay176220) countriesnew Country( Thailand", 513120) countriesl2] new Country Belgiun,30510) public interface Measurable Measurable maxCountry Data.max(countries) System.out-println( "Maxinum area:"maxCountry-getMeasure( System.out-printin("Expected: 513120" double getMeasure)i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
