This program is going to be the death of me i swear....
Anyway, i've just written a method that converts a location string that's in the format xxyy.zzzz into xx.yyyyyy using a conversion formula that i've been given. when i compile the code i'm getting cannot resolve symbol errors and i havent a clue why.... can anyone help me?
i get the errors on the lines that i've made boldCode:public double convert (String data){ //example of data "5115.1234 N" splitData = new String[2]; String xs; String ys; int i, length, j=7, post=0; double x, y, z, result; double ten=10, power; char direction; for(i=0; i<2; i++) { post = data.indexOf(".", j); //split the data in two at the dot splitData[i] = data.substring(j, post); j=post+1; } xs = splitData[0].substring(0, 4); ys = splitData[0].substring(4); x = Double.parseDouble(xs); y = Double.parseDouble(ys); length = splitData[1].length(); direction = splitData[1].charAt(length); StringBuffer sb = new StringBuffer(splitData[1]); sb.deleteCharAt(length); //the string needs to be put in a buffer to remove the last element splitData[1] = sb.toString(); z = java.lang.Double.parseDouble(splitData[1]); power = length - 1; z = z / Math.pow(ten, power); //change z to 0.z y = (y+z)/60; // conversion formula result = x+y; return result; }

Reply With Quote


