Question: please help Suppose that a class Location has been defined for storing information about global map locations. Each location keeps track of its name (a

please help please help Suppose that a class Location has been defined for storing

Suppose that a class Location has been defined for storing information about global map locations. Each location keeps track of its name (a string), its latitude (a real number), and its longitude (a real number). The class includes the following members: Name Description private String name name of location private double latitude location's latitude private double longitude location's longitude public Location(String name, double latitude, double longitude) constructs a location with given namo, latitude, longitudo public String getName() returns the name public double getLatitude() returns the latitude public double getLongitude() returns the longitude public String toString() returns a String representation of the location Your task is to modify the class to be comparable by adding an appropriate compareTo method. Locations should be ordered first by latitude with locations closer to the equator considered less than locations farther from the equator. When the latitudes are equal, you should examine longitudes with locations closer to the prime meridian considered less than locations farther from the prime meridian Latitudes are expressed relative to the equator with negative latitudes considered to be in the southern hemisphere and positive latitudes considered to be in the northern hemisphere. Thus. O represents the equator. -90 represents the South Pole and 90 represents the North Pole. Longitudes are expressed relative to what is known as the prime meridian (the line of longitude that runs through Greenwich, England), with positive longitudes considered to be in the western hemisphere and negative longitudes considered to be in the eastern hemisphere. Longitudes can range from -180 to 180. You may assume that your constructor is passed legal values for latitude and longitude. You are allowed to use the Math.abs method to find the absolute value of a number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!