Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

import java.util.Scanner; import java.lang.Object; /** * This program takes user

ID: 3628403 • Letter: I

Question

import java.util.Scanner;
import java.lang.Object;
/**
* This program takes user input to find your location.
* and relay the distance from your location to your home.
*@author blah
*@version 9-8-2011
*/
public class LocationFinder
{
/** This is a javadoc comment
*@param args User-defined command line arguments (not used).
*/
public static void main(String[] args)
{
Scanner Location = new Scanner(System.in);
double AngleToTurn, TimeToArrive, DistanceToLoc, x1, x2, y1, y2, Speed;
double Distancex, Distancey;
String TargetLocName;

System.out.print("Please enter current location (x1,y2): x1> ");
x1 = Double.parseDouble(Location.nextLine());
System.out.print(" y1> ");
y1 = Double.parseDouble(Location.nextLine());

System.out.print("Please enter the target location coordinates (x2,y2): x1> ");
x2 = Double.parseDouble(Location.nextLine());
System.out.print(" y2> ");
y2 = Double.parseDouble(Location.nextLine());

System.out.print("Please enter the speed(mph): ");
Speed = Double.parseDouble(Location.nextLine());
System.out.print("Please enter the name of your target location: ");
TargetLocName = Location.nextLine();

DistanceToLoc = Math.sqrt((Math.pow(x2-x1, 2)) - (Math.pow(y2-y1, 2)));
Distancex = Math.sqrt((Math.pow(x2-x1, 2)) - (Math.pow(1-1, 2)));
Distancey = Math.sqrt((Math.pow(1-1, 2)) - (Math.pow(y2-y1, 2)));
AngleToTurn = Math.atan2(Distancey,Distancex);
TimeToArrive = (DistanceToLoc / Speed);

System.out.println(" ");

System.out.println("Distance to " + """ + TargetLocName + """
+ " is: " + DistanceToLoc);

System.out.println("Angle to turn: " + AngleToTurn);
System.out.println("Estimated time until arrival: " + TimeToArrive);




}
}









Can you please tell me the error in answer

Explanation / Answer

DistanceToLoc = Math.sqrt((Math.pow(x2-x1, 2)) + (Math.pow(y2-y1, 2))); Distancex = Math.sqrt((Math.pow(x2-x1, 2)) + (Math.pow(1-1, 2))); Duse use + in place of minus