Question: Topic: AP Computer Science A | C++ Programming Your sports league uses the following lottery system to select draft picks for the four worst teams

Topic: AP Computer Science A | C++ Programming Your sports league uses the following lottery system to select draft picks for the four worst teams in the league: The last place team gets 20 balls in an urn. The second-to-last place team gets 10 balls in the urn. The third-to-last place team gets 6 balls in the urn The fourth-to-last place team gets 4 balls in the urn. To determine the first pick in the draft a ball is selected at random. The team owning that ball gets the first pick. The ball is then put back in the urn. To determine the second pick in the draft a ball is selected at random. If the ball belongs to the team that got the first pick then it is put back in and the process repeats until a ball is selected that does not belong to the first pick. To determine subsequent picks in the draft the process repeats until a ball is selected that belongs to a team that has not already been chosen. Write a function that takes as input which of the four teams have already been granted picks, simulates selecting a ball from the urn according to the lottery rules, and returns the team that belongs to the selected ball. You get to choose how to design your function to perform these actions. Write a main function that outputs the draft order (e.g., a possible order is: second-to-last picks 1, last place picks 2, third-to-last picks 3, and fourth-to-last picks 4). If you change the random seed then the order should differ if you run the program multiple times. For a slightly harder version of the problem, allow the user to input the names of the four teams. The program should then output the team names in the draft order.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!