Code example for Location

Methods: distanceTosetLatitudesetLongitude

0
	public double getDistanceTravelled(double originLatitude,
			double originLongitude, double destinationLatitude,
			double destinationLongitude) {
		 
		// origin location 
		Location originLocation = new Location("");
		originLocation.setLatitude(originLatitude);
		originLocation.setLongitude(originLongitude);
 
		// destination location 
		Location destinationLocation = new Location("");
		destinationLocation.setLatitude(destinationLatitude);
		destinationLocation.setLongitude(destinationLongitude);
		 
		// calculate the distance between the two locations 
		float distance = originLocation.distanceTo(destinationLocation);
		 
		// round the float and return 
		// TODO might need more here.. test cases will find that out 
		//return Math.round(distance); 
		return distance;