how to calculate the distance between two points and find the fare
accordingly
jcJobNo.setText(Contsants.Jobno);
jcStartTime.setText(Contsants.jobStartTime);
jcEndTime.setText(Contsants.jobEndTime);
// total distance finding here
float totalKm = Contsants.jobEndKm-Contsants.jobStartKm;
jcTotalKms.setText(Float.toString(totalKm));
//jcTotalKms.setText(Float.toString((float) (totalKm/16.0)));
//finding total fare here
float totalfare=totalKm *16;
jcTotalFare.setText(Float.toString(totalfare));
here is a simple code for calculating the distance between two points and
calculate the fare according to the distance. But i din't get exact fare
value and the output is in negative. I don't know how to resolve this
error. If any one knows please help me.
No comments:
Post a Comment