The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
hello,
i have the most of the RAPTOR figured out, i just need to find out, when i sort how i can keep the INDEX sorted too.Â
Like: Player [1]= joe, after sort have to be Player [4]=joe.Â
my assignment is:
Problem Statement
Assume the Scores array is parallel to the Players array (both arrays are below).
Scores array
Scores[0] = 198
Scores[1] = 486
Scores[2] = 651
Scores[3] = 185
Scores[4] = 216
Scores[5] = 912
Scores[6] = 173
Scores[7] = 319
Scores[8] = 846
Scores[9] = 989
Players Array
Players[0] = "Joe"
Players[1] = "Ann"
Players[2] = "Marty"
Players[3] = "Tim"
Players[4] = "Rosy"
Players[5] = "Jane"
Players[6] = "Bob"
Players[7] = "Lily"
Players[8] = "Granny"
Players[9] = "Liz"
Write a looping program that presents the user with 3 options:
1) Sort Output by Players
2) Sort Output by Scores
3) Exit Program
When the first option is selected, sort the Players array in alphabetical order, keeping the Scores array parallel. Add code that determines the highest and lowest scores in the list. Include code to display each player’s score and name in the sorted order. Below the sorted list display the highest and lowest scores in the list and the name of the player who received that score. Your sort by Player output display should look like this:
Scores Sorted by Player:
486 Â Â Ann
173 Â Â Bob
846 Â Â Granny
912 Â Â Jane
198 Â Â Joe
319 Â Â Lily
989 Â Â Liz
651 Â Â Marty
216 Â Â Rosy
185 Â Â Tim
-----------------------------------
989 Â Â Highest Score by Liz
173 Â Â Lowest Score by Bob
When the second option is selected, sort the Scores array in numerical order, keeping the Players array parallel. Add code that determines the average score of the entire list. Include code to display each player’s score and name in the sorted order. Below the sorted list display the average of all scores in the list. Your sort by Scores output display should look like this:
Players Sorted by Scores:
173 Â Â Bob
185 Â Â Tim
198 Â Â Joe
216 Â Â Rosy
319 Â Â Lily
486 Â Â Ann
651 Â Â Marty
846 Â Â Granny
912 Â Â Jane
989 Â Â Liz
---------------------------
498 Â Â Average Score
Â
Thank you.Â