Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public static void main(String[] args) throws IOException
  2. {
  3. int playersTotal = 0;
  4. int entries = 0;
  5. int namesIndex = 0;
  6. int attackIndex = 0;
  7. int blockIndex = 0;
  8. String[] playersName = new String[60];
  9. double[] attackScores = new double[60];
  10. double[] blockScores = new double[60];
  11. String file = "roster1.txt";
  12. Scanner scanner = new Scanner(new File(file));
  13. scanner.useDelimiter(" ");
  14.  
  15. while(scanner.hasNextLine())
  16. {
  17. playersName[namesIndex] = scanner.next();
  18. System.out.println(playersName[namesIndex]);
  19. namesIndex ++;
  20. playersName[namesIndex] = scanner.next();
  21. System.out.println(playersName[namesIndex]);
  22. namesIndex ++;
  23. entries ++;
  24. attackScores[attackIndex] = scanner.nextDouble();
  25. System.out.println(attackScores[attackIndex]);
  26. attackIndex ++;
  27. entries ++;
  28. //problem occurs here:
  29. blockScores[blockIndex] = scanner.nextDouble();
  30. System.out.println(blockScores[blockIndex]);
  31. blockIndex ++;
  32. entries ++;
  33. playersTotal ++;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement