Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the two java source files: Data.java and Measurable.java. Finish the following problems based on these files. Implement a class Country that implements the Measurable

Given the two java source files: Data.java and Measurable.java. Finish the following problems based on these files. Implement a class Country that implements the Measurable interface. The class should have two instance variables: countrys name and total area of the country.

Add a method public static Measurable max(Measurable[] objects) to the Data class that returns the object with the largest measure.

Implement MeasurableTester class to create three Country objects and print out the maximum area among the three countries.

Implement a class Quiz that implements the Measurable interface. A quiz has a score and a letter grade (such as B+).

Implement QuizTester class to use the Data class to process an array of quizzes. Display the average score and the quiz with the highest score (both letter grade and score).

public class Data { /** Computes the average of the measures of the given objects. @param objects an array of Measurable objects @return the average of the measures */ public static double average(Measurable[] objects) { double sum = 0; for (Measurable obj : objects) { sum = sum + obj.getMeasure(); } if (objects.length > 0) { return sum / objects.length; } else { return 0; } } }

/** Describes any class whose objects can be measured. */ public interface Measurable { /** Computes the measure of the object. @return the measure */ double getMeasure(); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago