Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help wioth my code please public interface Measurable { double getMeasure ( ) ; } public class Country implements Measurable { private String
I need help wioth my code please
public interface Measurable
double getMeasure;
public class Country implements Measurable
private String name;
private double area;
public CountryString name, double area
this.name name;
this.area area;
public String getName
return name;
public double getArea
return area;
@Override
public double getMeasure
return getArea;
public class Util
public static double averageMeasurable objects
double sum ;
for Measurable obj : objects
sum obj.getMeasure;
return objects.length sum objects.length : ;
public class AverageArrayTester
public static void mainString args
Measurable countries new Measurable
new CountryCountry A
new CountryCountry B
new CountryCountry C
;
double averageArea Util.averagecountries;
System.out.printlnThe average area is: averageArea;
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