Question: Create the following program: Description: Draw an initial rectangle in turtle graphics, then solicit user to input to decrease the rectangle by an entered percentage.

Create the following program:
Description: Draw an initial rectangle in turtle graphics, then solicit user to input to decrease the rectangle by an entered
percentage.
Create two constants ANGLE and LENGTH and initialize them with 90 and 200 respectively
Create variables named inputPercent and modifiedLength and initialize them with the string start and zero,
respectively
Draw an initial rectangle (using red pen color) using the constants and a for loop with the range function
Stop here and test your program, making sure it works correctly.
Create a while loop and loop as long as inputPercent is unequal to zero
Use the input function to get a negative percentage value from the user and store it in inputPercent
Perform validation on inputPercent to ensure it is less than 0 and greater than or equal to negative 100
If the validation is successful, calculate the modified length by using the constant LENGTH and the inputPercent
value (for example, if user enters -25 the modified length is 75% of LENGTH)
Within the loop, redraw the rectangle using a black pen, the modifiedLength and constant ANGLE, but otherwise
same code as initial rectangle
After the loop display a statement that the loop is exited (see output below)
Hide the turtle and use the command exitonclick to ensure the turtle window remains open
 Create the following program:Description: Draw an initial rectangle in turtle graphics,

Description: Draw an initial rectangle in turtle graphics, then solicit user to input to decrease the rectangle by an entered percentage Create two constants ANGL.E and LENGTH and initialize them with 90 and 200 respoctively Create variables named inputPercent and modifiedtength and initialine them with the string start and zero, respectively Diaw an initial rectangle (using red pen color) using the constants and a for loop with the range function Stop bere and test your program, making sure it works correctly. Create a while loop and loop as long as inputPereent is unequal to zero Use the inpur function to get a negative percentage value from the user and store it in inputPercent Perform validation on inputPereent to ensure it is less than 0 and greater than or equal to negative 100 . If the validation is successful, calculate the modified length by using the constant LENGTH and the inputPercent:value (for example, if user enters - 25 the modifted length is 75\% of LENGTH) Within the loop, redraw the rectangle using a black pen, the modiffodlength and constant ANGLE, but otherwise same code as initial rectangle After the loop display a statement that the loop is exited (see output below) Hide the turtle and use the command exitonclick to ensure the turtle window remains open

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!