Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago