import java.util.Arrays;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintWriter;
import java.io.IOException;
public class traineroutput {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader (newFileReader ("c:/input.txt")); //Read Input File
while(true) {
String lines = br.readLine();
String [] Array1= lines.split("\\r?\\n");
Arrays.toString(Array1);
for (int i=1; i<489; i++){
String [] Array2=String(Array1[i]).split(" ");
String [] Array3=Array1[i-1].split(" ");
Array2[0]=lat1;
Array2[1]=lon1;
Array2[2]=z1;
Array3[0]=lat2;
Array3[1]=lon2;
Array3[2]=z2;
double lat1, lon1, lat2, lon2;
double theta1, theta2;
double x1, x2, x3, y1, y2, y3, z1, z2;
int=63710000; //Earth Radius (in m)
double lat3= ;
double lon3= ;
double z3= ;
x1=r*Math.cos(deg2rad(lat1/100))*Math.cos(deg2rad(lon1/100)));//convert string gps to x coordinates
x2= r*Math.cos(deg2rad(lat2/100))*Math.cos(deg2rad(lon2/100)));//previous gps
x3= r*Math.cos(deg2rad(lat3/100))*Math.cos(deg2rad(lon3/100)));//target point gps
y1= r*Math.cos(deg2rad(lat1/100))*Math.sin(deg2rad(lon1/100);//convert the current gps into y coordinates
y2= r*Math.cos(deg2rad(lat2/100))*Math.sin(deg2rad(lon2/100));//previous gps
y3= r*Math.cos(deg2rad(lat3/100))*Math.sin(deg2rad(lon3/100));//target point gps
//z can be used as an elevation value.
double a= (y1-y2)/(x1-x2); // inclines
double b= (y3-y1)/(x3-x1);
double c= (z1-z2)/(x1-x2);
double d= (z3-z1)/(x3-x1);
theta2= Math.atan(Math.abs(a-b)/(1+a*b));
theta1= Math.atan(Math.abs(c-d)/(1+c*d));
PrintWriterpw = new PrintWriter ("c:/output.txt"); //Create Output File
{
pw.print(theta1);
pw.println(" "+ theta2);
}
pw.close();
}
if (lines==null) break;
}
br.close();
}
//Convert a given degree value to a radion
private double deg2rad(double deg){
return (double)(deg * Math.PI / (double)180);
}
// Convert a given radian value to a degree value
private double rad2deg(double rad){
return (double)(rad * (double)180 / Math.PI);
}
}
I'm sorry...You posted a shabby question in a precious place.
It's a really sloppy code, but they keep saying that there's a problem with the type conversion in eclipse...
I would really appreciate it if you could point out any advice or problems in any way! crying
There are a lot of compilation errors... Did you put the whole sauce on it? If you are not going to upload the completed code, it is recommended that you write down exactly what error message occurs on which line. I don't know where you wrote 'There is a problem with type conversion in clipse'.
So if you see a compilation error:
String [] Array2 = String(Array1[i]).The method split("); // String does not exist.
// Omitted
Array2[0] = lat1; // there is no variable named lat1.
// Omitted
Double lat3 = ; // Invalid variable initialization grammar.
// Omitted
x1= r*Math.cos(deg2rad(lat1/100))*Math.cos(deg2rad(lon1/100));
// The deg2rad method is declared as a non-static method.
// Non-static methods should not be invoked in a static calling manner.
// Change to the non-static method call method, or
// You must attach the static keyword to the method declaration and change it to the static method.
© 2024 OneMinuteCode. All rights reserved.