Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Create a Pen class and integrate it into Turtle.

1 visualizzazione (ultimi 30 giorni)
Estefania Dimas Martinez
Estefania Dimas Martinez il 17 Ott 2016
Chiuso: John D'Errico il 17 Ott 2016
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);

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by