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

Login to view and/or buy answers.. or post an answer

Related Questions

Similar orders to Code to be done in Java
43
Views
0
Answers
PG2 – LAB 2: BLACKJACK OBJECTS
CONTENTS Overview........................................................................................................................................................................2 Part A - Classes......................................................
24
Views
0
Answers
Excel Project with Documentation
In a new sheet, create one-variable data tables for these food items. For each previously selected food item, create a two-variable data table that calculates the amounts of calories based on various portion sizes and the number of portions. I have att...
52
Views
0
Answers
Computer Vision - (Machine Learning, Artificial Intelligence field) assignment in python
Video processing, image processing, object detection, object tracking, background removel. It needs to be in PYTHON. Objective The goal of this project is to develop an automatic system for video analysis of footages for the game of curling. The system...
19
Views
0
Answers
Writing and understanding simple java program code
I need help writing a java program with an Eclipse IDE. Once written I need to identify, objects, lists, algorithms, set of instructions, anything that explains how the code is written, what it does, and how an end user will use it...