
#sample outputs




from turtle import *
tobj = Turtle()
#get circles information from user
print("Circle 1");
c1x = int(input("Enter x coordinate:"))
c1y = int(input("Enter y coordinate:"))
r1 = int(input("Enter radius:"))
print("Circle 2");
c2x = int(input("Enter x coordinate:"))
c2y = int(input("Enter y coordinate:"))
r2 = int(input("Enter radius:"))
#draw circles
tobj.penup()
tobj.setposition(c1x,c1y)
tobj.pendown()
tobj.circle(r1)
tobj.penup()
tobj.setposition(c2x,c2y)
tobj.pendown()
tobj.circle(r2)
#intersection formula
dsq = (c1x - c2x) * (c1x - c2x) + (c1y - c2y) * (c1y - c2y)
rsq = (r1 + r2) * (r1 + r2)
if (dsq < rsq):
print("Circles intersect")
else:
print("Circles Does not intersect")
Write a program that takes as input an x,y center value and radii for two circles,...
In Python: Write a program that determines whether two circles intersect. The input should consist of six numbers, x1, y1, r1 and x2, y2, r2, given as command-line arguments, and representing the center and radius of the two circles. Your program should print True if the two circles intersect, and False otherwise. As a reminder, the two circles intersect if and only if the distance of their two centers is less than or equal to the sum of their two...
**Program must be written in Pascal** There are 1 to N non-intersecting circles (where N be any number between 2 and 10). Start at circle 1 and randomly choose among the out arrows (all out arrows should be equally likely to be picked). The next circle is the new current circle. Each visited circle gets a "check mark" to indicate it has been visited. Once all circles have at least one check mark, stop the game. Write a program that...
In python Simply write the Euclid algorithm in a form that takes two numbers from input and prints the gcd. The code does not need to check for valid input. It must work for any pair of positive integers. Create a separate program that uses the python timeit module to provide test run-times for your code. Provide at-least 5 sample runs. Create a third file that implements another algorithm to find the gcd. Provide a program that uses the timeit...
FOR JAVA Write a program that takes two command line arguments: an input file and an output file. The program should read the input file and replace the last letter of each word with a * character and write the result to the output file. The program should maintain the input file's line separators. The program should catch all possible checked exceptions and display an informative message. Notes: This program can be written in a single main method Remember that...
You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using “a la russe” multiplication. The program must display your banner logo as part of a prompt to the user. The valid range of values is 0 to 6000. You may assume that the user will always enter numerical decimal format values. Your program should check this numerical range (including checking for negative numbers) and reprompt the user for...
Write a program called draw_shapes.py.
In your program,
Create a block header with:
your name
the date
a short description of what the program does:
Assignment 5: Draw shapes using turtle
Import the turtle module.
Create a window and screen (canvas) where your turtle will
draw. Make the window 400 pixels wide x 400 pixels high and give it
an indigo background and a title of "Shapes". Use this code to
create a window object:
# a place for the...
Write a program in C or a script in bash, called “compare” that takes two numbers on the command line and compares them. The program should print the result of the comparison. Specifically, it should print “<x> is <comparison> <y>”, where <x> is the first number, <y> is the second number and <comparison> is one of “equal to”, “greater than” or “less than”. If the two numbers are equal, the program should have an exit status of zero. The exit...
Write a program that prompts a user for an input string of length at least two and prints the string with the first half in upper case and the second half in lower case. If the length of the string is odd, the "second half" should be one character longer than the "first half". Show Hint
Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...
Write a C or C++ program A8p1.c(pp) that accepts one command line string parameter. Call the fork function to produce two processes. In the child process print out the lower case version of the string. In the parent process print out the reversed upper case version of the string (e.g. child: “abc”; parent: ”CBA”). You may call the toupper and tolower functions in the header <ctype.h> if you wish. Specify in the output whether the parent or child process is...