Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1.  public static void listToArray (ArrayList<MissWorld> alist, double[] resultArray)
  2.  {
  3.       double resultArray [] = new double [8];
  4.       for (int i = 0; i < resultArray.length; i++)
  5.          {
  6.          resultArray [i] = participantScores.get(i).average();
  7.          }
  8.       Arrays.sort(resultArray);
  9.          
  10.  }
  11.  
  12.  public static String findCountry (ArrayList<MissWorld> alist, double d)
  13.  {
  14.      String fc = null;
  15.    
  16.      for (MissWorld participant : alist)
  17.      {
  18.          if (participant.average() == d)
  19.          {
  20.              fc = participant.getCountry();  
  21.          }
  22.          
  23.      }
  24.  
  25.      return fc;
  26.  }
  27.  
  28.  public static void printFinalRanking (ArrayList<MissWorld> alist, double[] doubleArray)
  29.  {
  30.      System.out.print("Final ranking");
  31.      System.out.print("\nRank Country\n");
  32.      
  33.      int ranks = 8;
  34.      for (int i = 0; i < ranks; i++)
  35.      {
  36.         System.out.printf("%d\t", (i + 1));
  37.         for (double d : resultArray[i])
  38.          {
  39.              System.out.printf("%.1f\t", d);
  40.          }
  41.      }
  42.  }
  43.      
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement