#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...
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...
Write a program to play "Three Button Monte." Your program should draw three buttons labeled "Door 1' " " Door 2' " and "Door 3" in a window and randomly select one of the buttons (without telling the user which one is selected) . The program then prompts the user to click on one of the buttons. A click on the special button is a win, and a click on one of the other two is a loss. You should...
Exercise 3.1 (word count.py). Write a program that takes in a filename and string as input. Then print how many times that string appears inside the chosen file. If the file does not exist, continue asking for a filename until one is given that exists. Use your source code file as test input. Make sure to test files with that contain the same word multiple times. ? $ python3 word-count.py 2 Please enter a filename: wordcount.py 3 Please enter a...