Find the GPS locations for Atlanta, Georgia; Orlando, Florida; Savannah, Georgia; and Charlotte, North Carolina from www.gps-data-team.com/map/ and compute the estimated area enclosed by these four cities. (Hint: Use the formula in Exercise to compute the distance between two cities. Divide the polygon into two triangles and use the formula in Exercise to compute the area of a triangle.)
True or false? The argument for trigonometric methods is an angle in radians.
Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of a triangle and displays its area. The formula for computing the area of a triangle is
s = (side1 + side2 + side3)/2;
area =
Here is a sample run:

Program Plan:
• Create a class called Geography.
• Initialize the main method with variables side1,side2,side3,s, x1=51.5138505182, x2=28.5383355, x3=32.0835407, x4=35.2270869, y1= -0.15690922737098845, y2=
-81.37923649999999, y3= -81.09983419999998, y4=
-80.84312669999997.
• Calculating first triangle, using side1, side2, side3.
• Compute side1=Math.sqrt(Math.pow(x1-x2, 2)+Math.pow(y1-y2, 2)).
• Compute side2= Math.sqrt(Math.pow(x2-x3, 2)+Math.pow(y2-y3, 2)).
• Compute side3= Math.sqrt(Math.pow(x1-x3, 2)+Math.pow(y1-y3, 2)).
• Compute average side s=(side1+side2+side3)/2.
• Now compute area=Math.sqrt(s*(s-side1)*(s-side2)*(s-side3)).
• Calculating second triangle by taking side1, side2, side3 as follows.
• Compute side1=Math.sqrt(Math.pow(x1-x3, 2)+Math.pow(y1-y3, 2)).
• Compute side2=Math.sqrt(Math.pow(x4-x3, 2)+Math.pow(y4-y3, 2)).
• Compute side3=Math.sqrt(Math.pow(x1-x4, 2)+Math.pow(y1-y4, 2)).
• Compute average side of second triangle s=(side1+side2+side3)/2.
• Calculating area of second triangle, area=Math.sqrt(s*(s-side1)*(s-side2)*(s-side3)) + area.
• Display area enclosed by 4 cities in square kilometres.
• Close the main and class file.
Program Code:
/*******************************************************
* The java program Find the GPS locations for Atlanta,*
* Georgia; Orlando, Florida; Savannah, Georgia; and *
* Charlotte, North Carolina. Display The estimated *
* area enclosed by these four cities. *
******************************************************/
//Geography.java
public class Geography
{
public static void main(String[] args)
{
//Atlanta, Georgia; 51.5138505182,-0.15690922737098845
double x1 = 51.5138505182;
double y1 = -0.15690922737098845;
//Orlando, Florida; 28.5383355,-81.37923649999999
double x2 = 28.5383355;
double y2 = -81.37923649999999;
//Savannah, Georgia; 32.0835407,-81.09983419999998
double x3 = 32.0835407;
double y3 = -81.09983419999998;
//Charlotte, North Carolina;35.2270869,-80.84312669999997
double x4 = 35.2270869;
double y4 = -80.84312669999997;
// Calculating 1st triangle; p1, p2 and, p3
double side1 = Math.sqrt(Math.pow(x1 - x2, 2) +
Math.pow(y1 - y2, 2));
double side2 = Math.sqrt(Math.pow(x2 - x3, 2) +
Math.pow(y2 - y3, 2));
double side3 = Math.sqrt(Math.pow(x1 - x3, 2) +
Math.pow(y1 - y3, 2));
double s = (side1 + side2 + side3) / 2;
double area = Math.sqrt(s * (s - side1) * (s - side2) *
(s - side3));
// Calculating 2nd triangle; p1, p3 and, p4
side1 = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2));
side2 = Math.sqrt(Math.pow(x4-x3,2)+Math.pow(y4-y3, 2));
side3 = Math.sqrt(Math.pow(x1-x4,2)+Math.pow(y1- y4, 2));
s = (side1 + side2 + side3) / 2;
area = Math.sqrt(s*(s-side1)*(s-side2)*(s-side3))+ area;
//display the area enclosed by 4 cities.
System.out.println("The area enclosed by 4 cities is "
+area+ " km^2");
}//end of main
}// end of the class
Sample Output:
The area enclosed by 4 cities is 265.49516161009615 km^2