In the previous article, we have discussed about Java Program to Find Nth Angle of a Polygon Whose Initial Angle and per Angle Increment is Given
In this article we are going to see how to find angle on circumference subtended by the chord when the central angle subtended by the chord is given by using Java programming language.
Java Program to Find Angle Subtended by an Arc at the Center of a Circle when Angle Subtended by the Arc to Circumference is Given
Before Jumping into the program directly let’s see how to find angle on circumference subtended by the chord when the central angle subtended by the chord is given.
Explanation:
Suppose there is a circle with center O
It has a chord AB
Lets draw a point D
in the circumference of the circle.
The angle subtended by the given chord on the circumference is ADB
Angle subtended by chord on center of the circle is AOB
So the angle on the center of the circle is
angle AOC = 2* angle ADB
Example:
ADB = 40 AOC = 80
Let’s see different ways to find angle on circumference subtended by the chord when the central angle subtended by the chord is given.
Method-1: Java Program to Find Angle Subtended by an Arc at the Center of a Circle when Angle Subtended by the Arc to Circumference is Given By Using Static Input Value
Approach:
- Declare an double variable say ‘
a
’ and assign the value to it, which holds the angle made at the circumference of the circle. - Find the angle made at the center of the circle using the formula
2*a
- Print the result.
Program:
import java.io.*; class Main { public static void main(String [] args) { double a = 80.2; //formula to find angle made at the center of the circle double c = 2*a; System.out.println("The angle made at the center of the circle is " + c); } }
Output: The angle made at the center of the circle is 160.4
Method-2:Java Program to Find Angle Subtended by an Arc at the Center of a Circle when Angle Subtended by the Arc to Circumference is Given By Using User Input Value
Approach:
- Declare an double variable say ‘
a
’ and assign the value to it, which holds the angle made at the circumference of the circle. - Then we will take the value of “
a
” as user input using scanner class. - Find the angle made at the center of the circle using the formula
2*a
- Print the result.
Program:
import java.io.*; import java.util.Scanner; class Main { public static void main(String [] args) { // scanner class obj ref Scanner s = new Scanner(System.in); System.out.println("Enter the angle made at the circumference of the circle in degree"); // to take user input value double a = s.nextDouble(); // formula to find angle made at the circumference of the circle double c = 2*a; System.out.println("The angle made at the center of the circle is " + c); } }
Output: Enter the angle made at the circumference of the circle in degree 90.6 The angle made at the center of the circle is 181.2
Don’t stop learning now. Get hold of all the important Java fundamentals with the Simple java program example guide and practice well.
Related Java Programs: