Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ask the user to enter an integer number of dots to draw before drawing anything. Use a while loop to make sure that the
Ask the user to enter an integer number of dots to draw before drawing anything. Use a while loop to make sure that the user enters a number bigger than 0. Once the user enters a valid amount, draw a circular target with 3 concentric circles centered at (0, 0) on a 500 by 500 screen. (Use any colors you like but do NOT use random colors. Check the Adobe Color Wheel for some cool ones.) The innermost circle should have a radius of 50. The circle surrounding that should have a radius of 100. And, the circle surrounding that should have a radius of 150. After drawing the target use a for loop to draw the given number of dots entered by the user, one dot for each time around the loop. Each dot should be drawn at a random location with each coordinate between -200 and 200. Each dot should be of size 10 and should be drawn in a specified (not random) color based on where it falls in the target. Dots outside of the target should be drawn in black. (Make sure that the colors of the dots contrast with the colors of the target rings or else you won't see the dot. Note that this program does NOT use random colors. You pick the colors that will go in each ring of the target.) The program should count the number of dots that fall in each region as well as outside of the target. Below the loop (not inside it), the program should display in the shell (not in the drawing window) the number of dots in each region and calculate and display the percentage of dots in each region. Display the percentage with one decimal place. To be able to determine whether a dot is inside of a region within the circle, you will need to calculate the distance between the position of the dot (x, y) and the center of the circle which is at (0, 0). The formula for the distance is: dist = x + y Once the distance is calculated, you will need to use an if/elif statement to determine where the dot is by comparing the distance against the various radii starting with the one for the innermost circle.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Python program that accomplishes the task you described python impo...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started