Java Degrees to Radians

Java Degrees to Radians


Posted in : Java Posted on : October 28, 2011 at 5:53 PM Comments : [ 0 ]

In this section you will learn how to convert degrees into radians.

Java Degrees to Radians

In this section you will learn how to convert degrees into radians.

Here I am giving a simple example which is concern to converting the degree(s) value into radians. In Mathematics like the radian (SI unit), degree is not a SI unit it is only an accepted unit in SI brochure to measure the plane angle, In terms of radian 1 degree is equivalent to Π180.

DegreeToRadian.java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class DegreeToRadian
{
public static final double PI= 3.141592653589793;
public double radian(double deg)
{
double rad = (deg*(PI / 180));
return rad;
}
public static void main (String arr[]) throws IOException
{
DegreeToRadian rd = new DegreeToRadian();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the value in degree(s)");
double degree = Double.parseDouble(br.readLine());
System.out.println("degree '"+degree+"' = "+rd.radian(degree)+" radian");
}
}

Output :

When you will execute the above example you will get the output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics