Question: 2. Modify your Turtle class to allow the user to change the pen color and pen width. The initial color is 'black', and the initial
2. Modify your Turtle class to allow the user to change the pen color and pen width. The initial color is 'black', and the initial width is1. Test your code by drawing rainbow concentric boxes You will need to add two properties to the Turtle class: pen width- the width of the pen pen color- the color of the pen You will need to add two methods to the Turtle class: ghi-renColor(obi.new color)- changes the pen color oki- penWidth(obi.new. width) - changes the pen width You will need to change the code of the forward obi.distance) method to use the stored values of pen width and pen color properties instead of the hardcoded values. 100 90 80 70 60 50 40 30 10 100
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
