For my program I need to declare 2 arrays. One of ids and the other of scores. each id has a corresponding score. I need to sort the scores from highest to lowest and print it in a table next to the scores id. I know how to sort the scores no problem. But i am unsure as to how to get the id's in the array to change in the same order as the scores. For example the score 312 was in index 4 before the sort. And the id 928 was in index 4. After the sort 312 is now in the index 13 but its corresponding id is still in index 4. How would I be able to fix it?
Edit: I would love not to use 2 arrays but I'm afraid its a requirement
class Score { String id; int score; }and store an array of those.