Question

In: Advanced Math

Use the Function Design Recipe (FDR) to design, code and test the definition of a new...

Use the Function Design Recipe (FDR) to design, code and test the definition of a new function named distance. This function returns the distance between two points, given by the coordinates (x1, y1) and (x2, y2). The function parameters are the x and y values.

Need help. Thank you

Solutions

Expert Solution

def area_of_circle(x1:'float',y1:'float' , x2:'float',y2:'float') -> 'float':
   """
       function that takes 2 points the cener of circle x1,y1
       and point on the permieter x2,y2 and returns the
       area of the circle
   """
   #calculate the distance between center and point
   #then find the area of that distance.
   return area_of_disk(distance(x1,y1,x2,y2))

x1,y1 = 10,20
x2,y2 = 6,10

print("\nArea of Disk of radius 10 :",area_of_disk(10))

print("\nDistance between point ({},{}) , ({},{}) is {}".format(x1,y1,x2,y2,distance(x1,y1,x2,y2)))

print("\nArea of the circle for above points. ({},{}) , ({},{}) is {}".format(x1,y1,x2,y2,area_of_circle(x1,y1,x2,y2)))


Related Solutions

Use the Design Recipe to write a function count_vowels, which consumes a string and returns the...
Use the Design Recipe to write a function count_vowels, which consumes a string and returns the number of vowels in that string. For these purposes, the vowels are a, e, i, o, and u, but never y. Include a Docstring! Note: Count both upper and lowercase vowels! Write 3 assert_equal statements to test your function.
A successful waffle-man has recently developed a new recipe for waffles. To test the popularity of...
A successful waffle-man has recently developed a new recipe for waffles. To test the popularity of this new waffle compared to two other tried-and-true types of waffles, our friend the waffle-man randomly selected 180 lucky customers to vote on which of the three waffle types they liked best. Exactly 35% of these customers (or 63 in total) voted in favor of the new waffle. If all waffles were equally tasty, then the waffle-man knows to expect that each waffle would...
FDR and the New Deal Assess the strengths and weaknesses of the New Deal. Why did...
FDR and the New Deal Assess the strengths and weaknesses of the New Deal. Why did some Americans oppose the New Deal? Use examples from the essays by David Kennedy or Matthew Avery Sutton and from one document in Major Problems. You may use brief quotes from the authors but be sure to assess their arguments in your own words.
CODE IN JAVA Create a new class named Task1. In its main function, use Scanner to...
CODE IN JAVA Create a new class named Task1. In its main function, use Scanner to read integers from the keyboard with the method nextInt. Use a try catch block to capture non-integer input, and tell the user, "This is not an Integer". The program loop should end when the user enters the string "quit". (Hint: "quit" is clearly not a number and will be captured in the try / catch block.) A typical Output Dialog is shown below: Enter...
/*Design and code and test a class MaxMin that has the following properties * two integer...
/*Design and code and test a class MaxMin that has the following properties * two integer member variables, min and max where min is smaller or equal than max at all times * A default constructor that sets both min and max to 0 * A constructor that accepts one integer and sets both min and max to that integer * A constructor that accepts two integers and sets min the smallest and max the largest * * Setters and...
Write a python code to Design and implement a function with no input parameter which reads...
Write a python code to Design and implement a function with no input parameter which reads a number from input (like 123). Only non-decimal numbers are valid (floating points are not valid). The number entered by the user should not be divisible by 10 and if the user enters a number that is divisible by 10 (like 560), it is considered invalid and the application should keep asking until the user enters a valid input. Once the user enters a...
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code...
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code and testbench. Use for-generate if possible
Write the Verilog code and test bench for the following circuits: - Mealy State machine design...
Write the Verilog code and test bench for the following circuits: - Mealy State machine design for a Serial Adder Circuit - Moore State Machine design for a Serial Adder Circuit
Design, code, and test a program that accepts positive integers until the value 204 is entered....
Design, code, and test a program that accepts positive integers until the value 204 is entered. After input terminates, the program should report the total number of even integers (excluding the special number 204) , the average value of the even integers, the total number of odd integers, and the average value of the odd integers. The program should also report "Evens won!", "Odds won!", or "Evens and odds tied!" based on which total was greater. Test your program thoroughly...
Design and write an efficient Python function (with tester code) for finding the 10 largest elements...
Design and write an efficient Python function (with tester code) for finding the 10 largest elements in a sequence of size n, where n >= 50. In your tester function, write code that generates at least 50 random numbers and stores them in an array, then calls your function on that array (and prints the resulting 10 largest elements). This function must be as efficient as possible. Marks will be deducted for a slow function, even if it actually answers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT