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.
-
In Problems 6568, assume that the minimum payment on a credit card is the greater of $20 or 2% of the unpaid balance. If the annual interest rate is 20.99%, find the difference between the minimum...
-
Jason Cannon purchased a defective tractor for which Cannon brought numerous causes of action against Bodensteiner Implement Company (Bodensteiner). One of the claims was breach of express...
-
Sawyer Furniture is one of the few remaining domestic manufacturers of wood furniture. In the current competitive environment, cost containment is the key to its continued survival. Demand for...
-
thank you I've been having lots of troubles opening any documents in full they just appear as blank would you know why this is or perhaps be able to assist me
-
Please answer the following questions after carefully reading the paper: P. Falcoz, C. Binquet, F. Clement, D. Kaili, C. Quantin, S. Chocron and J. Etievent (2003) Management of the second episode of...
-
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...
-
In what ways does a Critical Chain plan address Demings concerns about common cause variation?
-
In September 2020, Mimi received an offer from a potential buyer to acquire the property and received a deposit of RM17,000. The potential buyer decided not to pursue the acquisition as Covid case...
-
Suppose that Fox Entertainment Group has just made an offer to acquire CKX, the firm that owns American Idol.Prior to the offer, CKX had 30 million shares outstanding that traded at a price of $25,...
-
Develop a policy that outlines what police offi- cers should do if they arrive on a domestic vio- lence call involving a police officer. Outline the investigative and administrative follow-up that...
-
Cheron had the following medical expenses in 2023. Her AGI is $94,000. How much of her medical expenses are deductible, if she itemizes? Medical insurance premiums paid pre tax through her employer's...
-
Suppose that the expected return of the market portfolio is 10% and the risk-free rate is 2%. Suppose a certain stock has a 1 of 1/2 (one half). According to the CAPM, what should the expected return...
-
On January 1, 2016, Cayce Corporation acquired 100 percent of Simbel Company for consideration transferred with a fair value of $126,000. Cayce is a U.S.-based company headquartered in Buffalo, New...
-
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.
-
You borrowed $ 1 1 , 0 0 0 from your bank to build a small cabin on your property . The bank will charge 1 0 % per year compounded quarterly . You decide to payoff this loan in 2 years making...
-
A n IOU for $ 1 , 0 0 0 can be cashed exactly five years from now. what is the present value, assuming a discount rate of 5 . 2 5 % compounded semiannually?
-
The US 1 year spot rate is 2.16% and the Mexican 1 year spot rate is 4.09%. A US investor purchases a Mexican corporate bond with an expected 1 year return of 9.67%, as measured in Mexican peso. The...
Study smarter with the SolutionInn App