Code to be done in Java
CODE IN JAVA
PART 1 (10 points)
- Create a Country class that implements the interface Measurable. A country has the name (String) of the country and its land’s surface area (double). The method getMeasurementshould return the surface area.
- You are given the interface Measurable and driver class MeasurableTester
- Make sure the driver, MeasurableTester works with you new Country class.
PART 2 (4 points)
- Modify Measurable interface by creating a new static interface method:
public static Measurable max(Measurable list)
This method returns the object from the list that has the largest (measurable) value.
- Modify MeasurableTester to call this new method on the given array of countries.
PART 3 (10 points)
- Create a class Midterm that implements the Measurable interface. A Midterm object has both the score (double) and a student’s name (String). Modify MeasurableTester to create and process an array of midterms. Display the average score and the student with the highest score using the static methods of the interface
PART 4 (10 points)
- Modify the Country class to implement the Java API’s Comparable Interface based on the surface area
- 2 Steps:
- Use implements Comparable<Country> at the class declaration
- This means you have to implement the method:
public int compareTo(Country c);
- Modify MeasurableTester again and add code (similar to TeacherDriver2.java)
- Create five unordered Countries with values - store in an array named list (not an ArrayList)
- Print out array elements in the order stored in the array
- Call the static method Arrays.sort(list);
- (Don’t forget to import java.util.*;)
- Print out the elements of the array again - they should be in order now!
Get Help With a similar task to - Code to be done in Java
Tutlance Experts offer help in a wide range of topics. Here are some of our top services:
- Do my math homework
- Do my nursing homework
- Do my statistics homework
- Nursing coursework help
- Capstone project writing services
- Essay writers for hire
- Case study writing help
- Buy college papers online
- Buy college research papers
- College homework help
- Professional resume writing services
- Do my programming homework
- Do my engineering homework
- Coursework writing help
- Term paper writing help
- Biology assignment help
- Do my physics homework
- Dissertation data analysis help
- PhD Dissertation writing help
- Chemistry assignment help
Post your project now for free and watch professional experts outbid each other in just a few minutes.