Question

Define a function drawcircle . This function should expect a Turtle object, the coordinates of the circles center point, and
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-

The below is the required source code for the given problem in Python

Code:-

//import required header files:

import turtle

import math

def drawCircle(turtleobj, x, y, radius):

    distance = 2 * radius * math.sin (math.pi / 120)

    angle = 360 / 120

    turtleobj.penup()

    turtleobj.goto (x, y)

    turtleobj.pendown()

    for iter in range (120):

        turtleobj.forward(distance)

        turtleobj.left (angle)

def main():

    X=int(input("Enter X : "));

    Y=int(input("Enter Y : "));

    radius=int(input("Enter Radius : "));

    turtle.title ('Circle')

    turtle.setup (800, 800, 0, 0)

    ttl = turtle.Turtle()

    ttl.color ('Blue')

    drawCircle (ttl,X, Y,radius)

    turtle.done()

main()

If you find difficulty to understand the code, please let me know in comments tab below, Then I will provide another code or else i will any modifications in the present code. Hope it will helps you. Please give Thumbs Up!! Thank you for posting the question, All the best.

Add a comment
Know the answer?
Add Answer to:
Define a function drawcircle . This function should expect a Turtle object, the coordinates of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python version 3 Instructions ircle.py+ 1 2 3 Define a function drawCircle . This function should...

    python version 3 Instructions ircle.py+ 1 2 3 Define a function drawCircle . This function should expect a Turtle object, the coordinates of the circle's center point, and the circle's radius as arguments. The function should draw the specified circle. The algorithm should draw the circle's circumference by turning 3 degrees and moving a given distance 120 times. Calculate the distance moved with the formula 2.0 x π x radius +120.0 Define a function main that will draw a circle...

  • Hello! This is C++. Q3. Write a program Define a Super class named Point containing: An...

    Hello! This is C++. Q3. Write a program Define a Super class named Point containing: An instance variable named x of type int. An instance variable named y of type int. Declare a method named toString() Returns a string representation of the point. Constructor that accepts values of all data members as arguments. Define a Sub class named Circle. A Circle object stores a radius (double) and inherit the (x, y) coordinates of its center from its super class Point....

  • Task 5 Write a function called “earring_iter” that takes two integer arguments, size and count. This...

    Task 5 Write a function called “earring_iter” that takes two integer arguments, size and count. This function should use a (for or while) loop to draw a Hawaiian earring containingcount-manycircles,wherethefirstcircledrawnhassizesize,andeachsubsequent circle has size earring_ratio times the size of the previous circle. Here is a recursive specification for drawing a Hawaiian earring of a given size: • To draw a Hawaiian earring of a given size with zero hoops, do nothing. • To draw a Hawaiian earring of a given size...

  • 24&25 please The figure below shows the potential energy function U (r)for a particle moving along...

    24&25 please The figure below shows the potential energy function U (r)for a particle moving along an axis labeled by the coordinate r. Values for energy and distance are in joules (j) millimeters (mm), respectively. The total energy of this particle is E = -4 J. Initially, the particle is at r = 1 mm and moving to the right (direction of increasing r) Which of the following statements best describes the subsequent motion of this particle? a. The particle...

  • In C programming, code the following function: Write the function Location() that takes in two pairs...

    In C programming, code the following function: Write the function Location() that takes in two pairs of DEGREE (latitude, longitude) coordinates and returns the great-circle-distance between the points on the surface of the Earth, which is calculated using the formula: d = R acos[ cos(latA)cos(latB)cos(lonB-lonA) + sin(latA)sin(latB) ] where (latA,lonA) and (latB,lonB) are the RADIAN coordinates for the two points, R = 6368 km is the radius of the Earth (provided in the template as a global variable), d is...

  • Question 11 (20 points) Given the class Point below, define a class Circle that represent a...

    Question 11 (20 points) Given the class Point below, define a class Circle that represent a circle with a given center and radius. The circle class should have a center attribute named center as well as a floating point radius attribute. The center is a point object, defined by the class Point. The class should also have these members: the constructor of the class, which should take parameters to initialize all attributes - a getter for center a setter for...

  • Using separate files, write the definition for a class called Point and a class called Circle. Th...

    Using separate files, write the definition for a class called Point and a class called Circle. The class point has the data members x (double) and y (double) for the x and y coordinates. The class has the following member functions: a) void set_x(double) to set the x data member b) void set_y(double) to set the y data member c) double get_x() to return the the x data member d) double get_y() to return the the y data member e)...

  • In Matlab Write a function dubinsLSR.m that computes a two-dimensional left-straightright (LSR) Dubins path solution. Your...

    In Matlab Write a function dubinsLSR.m that computes a two-dimensional left-straightright (LSR) Dubins path solution. Your function should take the following input arguments (in this order): W0, W3, R. Your function should return Dubins waypoints W1, W2. R is turning radius, and each waypoint Wi must be a Matlab three-element row vector of Cartesian coordinates (xi , yi , ψi). All distance values are specified in meters, and headings ψi are in radians. In the LSR Dubins solution, the aircraft...

  • Pure Abstract Base Class Project. Define a class called BasicShape which will be a pure abstract class. The clas...

    Pure Abstract Base Class Project. Define a class called BasicShape which will be a pure abstract class. The class will have one protected data member that will be a double called area. It will provide a function called getArea which should return the value of the data member area. It will also provide a function called calcArea which must be a pure virtual function. Define a class called Circle. It should be a derived class of the BasicShape class. This...

  • Project 1 – Classes and Top-down Design Overview Software development projects using the object-oriented approach involve...

    Project 1 – Classes and Top-down Design Overview Software development projects using the object-oriented approach involve breaking the problem down into multiple classes that can be tied together into a single solution. In this project, you are given the task of writing some classes that would work together for providing a solution to a problem involving some basic computations. Learning Objectives The focus of this assignment is on the following learning objectives: • Be able to identify the contents of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT