예제 #1
0
 // getting the miniumum value
 public static Scene getMinValue(Scene[] scenes) {
   Scene minScene = scenes[4]; // get scene list from Scene class
   for (int i = 4; i < scenes.length - 1; i++) { // advance the position through the entire array
     if (scenes[i].getMilesFromNorthPole() < minScene.getMilesFromNorthPole()) {
       minScene = scenes[i]; // found new minimum; remember its index
     }
   }
   return minScene;
 }
예제 #2
0
  // getting the maximum value
  public static Scene getMaxValue(Scene[] scenes) {
    Scene maxScene = scenes[0]; // get scene list from Scene class

    // advance the positition through the entire array
    for (int i = 0; i < scenes.length - 1; i++) {
      if (scenes[i].getMilesFromNorthPole() > maxScene.getMilesFromNorthPole()) {
        maxScene = scenes[i]; //
      }
    }
    return maxScene;
  }