- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Angle at Centre from Angle at Circumference by an Arc in Java?
A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle.
And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius.
Arc of the circle refers to a part or portion of the circumference of a circle. In simple terms it is an open curve on the circumference of a circle.
Find angle at centre from angle at circumference by an arc in Java
The angle at the centre subtended by an arc is double of the angle at the circumference of the circle by the same arc. So, if the angle on circumference is given as ‘a’ then the angle on centre will be 2a.
As per the problem statement we have to find the angle on centre subtended by an arc when the angle on circumference subtended by the same arc is given.
So, let’s explore.
To Show You Some Instances
Instance-1
Let say angle at the circumference subtended by the arc is 30
Then by using the formula, the angle on centre subtended by the same arc is 60.
Instance-2
Let say angle at the circumference subtended by the arc is 35
Then by using the formula, the angle on centre subtended by the same arc is 70.
Instance-3
Let say angle at the circumference subtended by the arc is 40
Then by using the formula, the angle on centre subtended by the same arc is 80.
Algorithm
Step 1 − Get the angle at the circumference subtended by the arc either by static input or by user input.
Step 2 − Find the angle on the centre subtended by the same arc by using the formula.
Step 3 − Print the result.
Multiple Approaches
We have provided the solution in different approaches.
By Using Static Input Value
By Using User-Defined Method
By Using User Input Value
Let’s see the program along with its output one by one.
Approach-1: By Using Static Input Value
Example
In this approach, we declare a double variable and initialize it with the angle at the circumference subtended by the arc. Then by using the algorithm we can find the angle at the centre.
public class Main{ //main method public static void main(String[] args){ //angle at the circumference subtended by the arc float a = 40; //angle at the centre subtended by the same arc float result = 2*a; System.out.println("Angle on centre subtended by the same arc: "+result); } }
Output
Angle on centre subtended by the same arc: 80.0
Approach-2: By Using User Defined Method
Example
In this approach, we declare a double variable and initialize it with the angle at circumference subtended by the arc. Then call a user defined method by passing this angle as parameter and inside the method using the algorithm, we can find the angle at centre.
public class Main{ //main method public static void main(String[] args){ //angle at the circumference subtended by the arc float a = 40; float result = angleOncirCumference(a); System.out.println("Angle on centre subtended by the same arc: "+result); } //user defined method to find the angle //on circumference subtended by the samechord static float angleOncirCumference(float a){ return (2*a); } }
Output
Angle on centre subtended by the same arc: 80.0
Approach-3: By Using User Input Value
Example
In this approach, we declare a double variable and take the user input of the angle at circumference subtended by the arc. Then by using the algorithm we can find the angle at the centre subtended by the same arc.
import java.util.*; public class Main{ //main method public static void main(String[] args){ //Object of scanner class Scanner sc = new Scanner(System.in); System.out.println("Enter angle at circumference subtended by the arc:"); //taking user input of the angle at the circumference subtended by the arc float a = sc.nextFloat(); float result = 2*a; System.out.println("Angle on centre subtended by the same arc: "+result); } }
Output
Enter angle at circumference subtended by the arc: 35 Angle on centre subtended by the same arc: 70.0
In this article, we explored how to find the angle on centre subtended by an arc when the angle at circumference subtended by the same arc is given by using different approaches in Java.