Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //traitementVol
- public static void statistique3(){
- System.out.println("Les quatres extremes sont :" );
- afficherParcours(vol.LieuxExtremes());
- }
- //Vol
- public Coordonnees[] LieuxExtremes(){
- long maxLong = Long.MIN_VALUE, minLong = Long.MAX_VALUE, maxLat = Long.MIN_VALUE, minLat = Long.MAX_VALUE, courantLat, courantLong;
- int indiceEst = 0, indiceNord = 0, indiceOuest = 0, indiceSud = 0;
- for (int i = 0; i < tableCoordonnees.length; i++) {
- courantLat=tableCoordonnees[i].getLatitude();
- courantLong = tableCoordonnees[i].getLongitude();
- if(courantLat > maxLat){
- indiceNord = i;
- maxLat = courantLat ;
- }
- if (courantLat <= minLat) {
- indiceSud = i;
- minLat = courantLat;
- }
- if (courantLong >= maxLong) {
- indiceEst = i;
- maxLong = courantLat;
- }
- if (courantLong <= minLong) {
- indiceOuest = i;
- minLong = courantLong;
- }
- }
- Coordonnees [] extremes ={tableCoordonnees[indiceNord], tableCoordonnees[indiceSud], tableCoordonnees[indiceEst], tableCoordonnees[indiceOuest]};
- return extremes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement