Draw a circle with three random points on the circle. Connect the points to form a triangle.
Question:
Draw a circle with three random points on the circle. Connect the points to form a triangle. Display the angles in the triangle. Use the mouse to drag a point along the perimeter of the circle. As you drag it, the triangle and angles are redisplayed dynamically, as shown in Figure 15.30b. For computing angles in a triangle, see Listing 4.1.
Listing
Transcribed Image Text:
83.37 S1.07 45.56 (b) 1 import java.util.Scanner; 2 3 public class ComputeAngles { 4 public static void main(String[] args) { 5 Scanner input = new Scanner (System.in); 6 // Prompt the user to enter three points System.out.print("Enter three points: "); double x1 = input.nextDouble(); double yl = input.nextDouble(); double x2 = input.nextDouble(); double y2 = input.nextDouble(); double x3 = input.nextDouble(); double y3 = input.nextDouble(); 8. 9. 10 11 12 13 14 15 16 17 18 19 20 21 22 // Compute three sides double a = Math.sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)); double b Math.sqrt((x1 - x3) * (x1 - x3) + (yl - y3) * (yl - y3)); double c - + (yl - y2) * (yl - y2)); Math.sqrt((x1 - x2) (х1 - х2) 23 // Compute three angles double A = 24 Math.toDegrees (Math.acos ((a / (-2 * b * c))); double B = Math.toDegrees (Math.acos((b / (-2 * a * c))); double C = Math.toDegrees (Math.acos((c * c - b * b - a * a) / (-2 * a * b))); 25 26 27 c) 28 29 30 31 // Display results System.out.println("The three angles are Math.round(A * 100) / 100.0 + " " + 32 33 34 NNNN NNNN NNM mmmm
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (15 reviews)
Program Plan The program is designed to create a circle with three random points on the circumferenc...View the full answer
Answered By
Aditya Raj
If you find science boring , you are learning it from a wrong teacher. - Richard Feynman
Literally I believe if you face problems to understand the concepts of physics it means you are learning from a wrong teacher . I am trying to make concepts of physics relatively easy by relating it with some physical significance . I can build concepts of physics of a weak student with a proper guidance and also in a fun way . A student will learn something if his/her insterest develop in subject so first I try to pull interest towards basic physical activity and I clear his/her doubt regarding that activity .
To make physics easy i give many examples of daily life incidence regarding that concepts of physics which I am teaching.
These are my personal teaching strategies to make my studen's future better.
Thanks
0.00
0 Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
The great circle distance is the distance between two points on the surface of a sphere. Let (x 1 , y 1 ) and (x 2 , y 2 ) be the geographical latitude and longitude of two points. The great circle...
-
Write a program that generates three random points on a circle centered at (0, 0) with radius 40 and display three angles in a triangle formed by these three points, as shown in Figure 4.7a.? (a) A...
-
Define the Circle2D class that contains: Two double data fields named x and y that specify the center of the circle with getter methods. A data field radius with a getter method. A no-arg...
-
Explain why the economic order quantity is the intersection of the ordering-cost curve and the carrying-cost curve.
-
Given two functionals f and g on X, define (f g)(x) = max{f (x), g(x)} (f g)(x) = min{f (x), g(x)} If f and g are continuous, then so are f g and f g.
-
Transactions in a land titles system are less costly and time consuming because a person wishing to know the state of the title can consult the certificate of title and rely on its accuracy. Are...
-
Using the following data for Evans \& Sons, calculate the cash paid for rent: Rent expense... $80,000 Prepaid rent, January 1 10,000 Prepaid rent, December 31 8,000
-
4) You operate a Caribbean destination resort. You currently offer plans for a cruise departing from the resort and plans for a casino stay. It is expected that in 2021 there will be some return to...
-
Question 2 part 1. (15 points) Use the following data in order to calculate the mean (average return), variance, and standard deviation for the following 3 portfolios. Question 2 part 2. (2 points)...
-
Toll House makes chocolate chip cookies. The cookies pass through three production processes: mixing the cookie dough, baking, and packaging. Toll House uses process costing. The following are data...
-
Rewrite Programming Exercise 14.10 so that the cylinder?s width and height are automatically resized when the window is resized. Write a program that draws a cylinder, as shown in Figure. You can use...
-
Write a program that enables the user to drag the vertices of a triangle and displays the angles dynamically as the triangle shape changes, as shown in Figure 15.30a. The formula to compute angles is...
-
A news article on economist.com in late 2022 noted that the decision by the Venezuelan government to relax price controls has resulted in somewhat better times. Briefly explain why relaxing price...
-
Irna borrowed RM50,000 for her education purposes from PITIPITI Bank. The payments are to be made on an installment basis. The tenure of the loan is seven (7) years with 7 percent interest per annum....
-
Question 1 Envelope Company began operations this month mass-producing pull-and-seal envelopes. During the month of July, it completed 25,000 units and has 20,000 units that are 65% complete. It had...
-
What work teams are currently established within an organization and how are they supported? Are work teams encouraged within an organization? If so, how? If not, why are work teams not seemingly...
-
Understanding the value and organizational implications of big data analytics, how is the company going to progress through the analytics ladder and which obstacles does the company encounter and how...
-
Given log, 3 0.6826 and log, 81.2920, evaluate the expressions using rules of logs (not change of base law). (a) log, 2 (b) log 75
-
Using AOA, diagram the network described below for Roni Zuckermans construction project. Calculate its critical path. How long is the minimum duration of this network? Time (weeks) Time Nodes (weeks)...
-
Michelles trust is subject to 3.8% surtax on the lesser of the trusts net investment income or the excess of the trusts adjusted gross income over the $12,400 threshold (the highest trust tax rate)....
-
Write a short Java method that takes an integer n and returns the sum of all the odd positive integers less than or equal to n.
-
Write a short Java method that takes an integer n and returns the sum of the squares of all positive integers less than or equal to n.
-
Write a short Java method that counts the number of vowels in a given character string.
-
Question 2 MusicTogether.com will pay out its first dividend, $ 2 . 0 0 , one year from today. Analysts expect annual dividends to grow at a rate of 1 5 % per year for each of the following two years...
-
1- Compute the a. net present value and b. internal rate of return c. discount payback period of the following capital budgeting projects. The firm's required rate of return is 12 percent. PROJECTS...
-
Portfolio return and standard deviation Jamie Wong is thinking of building an investment portfolio containing two exchange traded funds (ETFs). Jamie plans to invest $3,000 in Vanguard S&P 500 ETF...
Study smarter with the SolutionInn App