フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Create a Pen class and integrate it into Turtle.

1 回表示 (過去 30 日間)
Estefania Dimas Martinez
Estefania Dimas Martinez 2016 年 10 月 17 日
閉鎖済み: John D'Errico 2016 年 10 月 17 日
Create a Pen class and integrate it into Turtle. Instead of having the Turtle remember the color and width of the pen, just give the Turtle a pen object to use. properties … pen_color % deleted pen_width % deleted pen % added ... end The Pen class should have properties color and width and methods Pen(), setColor(), setWidth(). Add a setPen() method to Turtle to handle changing the Turtle’s pen. You will also need to make small modifications to your other code to reflect the fact that the Turtle has a Pen object as a property. You can now define Pens the Turtle can use. For example: thick_red = Pen(); thick_red = thick_red.setColor(‘red’); thick_red = thick_red.setWidth(5); thin_blue = Pen(); thin_blue = thin_blue.setColor(‘blue’); thin_blue = thin_blue.setWidth(1); turtle = turtle.setPen(thick_red); … turtle = turtle.setPen(thin_blue);

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by