i have problem trying to create the class in this python 3 promblem
CODE SNIPPET:
COPY TO CODE:
import turtle
class Caterpillar:
#display function will call other function to draw catterpillar
def display(self,myTurtle) :
radius = 50;
myTurtle.speed(0);
lineSize = radius*2*3;
x = 50;
y = -120;
self.drawLegs(myTurtle,x,y,lineSize,radius);
self.antennae(myTurtle,x,y,lineSize,radius);
self.drawBody(myTurtle,radius,x,y);
input('ruko');
def drawBody(self,myTurtle,radius,x,y):
myTurtle.width(radius);
myTurtle.pencolor("#7FFF00");
self.drawCircle(myTurtle, radius,x,y);
self.drawCircle(myTurtle, radius,x,y+radius);
self.drawCircle(myTurtle, radius,x,y+radius*2);
self.drawCircle(myTurtle, radius,x,y+radius*3);
self.drawCircle(myTurtle, radius,x,y+radius*4);
def drawLegs(self,myTurtle,x,y,lineSize,radius):
myTurtle.width(1);
myTurtle.pencolor("purple");
self.drawLine(x-lineSize/2,y+radius,lineSize);
self.drawLine(x-lineSize/2,y+radius*2,lineSize);
self.drawLine(x-lineSize/2,y+radius*3,lineSize);
self.drawLine(x-lineSize/2,y+radius*4,lineSize);
def antennae(self,myTurtle,x,y,lineSize,radius):
myTurtle.width(1);
myTurtle.penup();
myTurtle.setposition(x,y+radius*6);
myTurtle.left(45);
myTurtle.pendown();
myTurtle.forward(lineSize/3);
myTurtle.right(45);
myTurtle.penup();
myTurtle.setposition(x,y+radius*6);
myTurtle.left(135);
myTurtle.pendown();
myTurtle.forward(lineSize/3);
myTurtle.right(135);
def drawCircle(self,myTurtle,radius,x,y) :
myTurtle.penup()
myTurtle.setposition(x,y)
myTurtle.pendown()
myTurtle.circle(radius)
def drawLine(self,x,y,size):
myTurtle.penup();
myTurtle.setposition(x,y);
myTurtle.right(135);
myTurtle.pendown();
myTurtle.forward(size/3);
myTurtle.penup();
myTurtle.left(135);
myTurtle.setposition(x,y);
myTurtle.pendown();
myTurtle.forward(size);
myTurtle.right(45);
myTurtle.pendown();
myTurtle.forward(size/3);
myTurtle.left(45);
#turtle - calling catterpiller class
myTurtle = turtle.Turtle(shape="turtle")
cp = Caterpillar();
cp.display(myTurtle);
OUTPUT:
i have problem trying to create the class in this python 3 promblem In this problem...
create a java class with the name Brick class: For this part of the assignment, you will create a class that allows you to specify a colored brick that is capable of drawing itself given a specified Graphics object. Note that this is a regular Java class and does not extend the JApplet class. Your class should a constructor with the following signature: Identifier: Brick(int xPosition, int yPosition, int width, int height, Color color) Parameters: xPosition – an int representing...
Java program GCompound Practice Exercise CS141 Assignment Write a class that represents a digital snowman. Your class should follow these guidelines: 1. Store the following private class variables bodyColor of type Color b. int x, int y for the upper left corner Graphics g. a. C. 2. Create two different constructor methods a. A (int x, int y, Graphics myG) parameter constructor that makes the snowman a light gray color by default and makes x and y the upper left...
Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...
PYTHON Task 1 Create a class called Window It has 2 public properties 1 private property 1 constructor that takes 3 arguments pass each argument to the appropriate property Task 2 In a new file import the Window class Instantiate the Window object Output the two public properties Task 3 Alter the Window class in Task 1 Add an accessor and mutator (the ability to access and change) to the private property Task 4 Create a class named Instrument Give...
Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor. Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...
Must be done in python. This will be connected to other turtle assignments. Might need a sleep at end. Swimming in a Pond In this function, you will draw a small pond and have the turtle first take a nice walk around it and then jump in. The pond will need to be drawn in the upper left quandrant of your screen. This function needs to do the following: Contain two parameters to denote the color of the path (pen...
Hi I have 4 problems below I need done ASAP, if you could upload them one by one by order you finish them instead of all at once that would be appreciated, I need this done in basic c++ code, all of the body structure are below I just need codes to be implemented for the codes to give the write outputs, Thank you. Q1. Update the given code 1 to implement the following problem: Create a class animal Set...
1. Please write the following program in Python 3. Also, please create a UML and write the test program. Please show all outputs. (The Fan class) Design a class named Fan to represent a fan. The class contains: Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed. A private int data field named speed that specifies the speed of the fan. A private bool data field named on that specifies...
Challenge: Recursion and Python Turtle Graphics Submit Assignment Due Friday by 11:59pm Points 100 Submitting a file upload Available after Nov 9 at 12am Challenge: Recursion and Python Turtle Graphics Description: Write a program that draws a picture using Python e, recursion, and Turtle graphics e. Purpose: The purpose of this challenge is to provide experience working with recursione in Pythone. It also provides experience working with Turtle graphics in Pythone Requirements: Recursion and Python Turtle Graphics provides information on...
please HELP!! I have been trying to get help for this problem forever! Create a class called planet with private members name, percent02, temp. Create a constructor prototype and implementation. In the main, create 2 objects of class planet, one with arguments and the other without. Create a function to change name, percent02 and temp after the object has been created and a function that displays the current values of the members. Implement the operations specified above in the main...