I made a code converting degrees to radians following my teacher's format but I want to try to make it in terms of pi. Right now when I plug in 30 as my degrees the output is a loooong decimal but I want it to come out as pi/6. Is there a way to keep the pi symbol in the output?
This is my current code:
public static double convertDeg(double deg)
{
double rad = deg * (Math.PI/180);
return rad;
}
and
System.out.println("Degrees to radians: "+Calculate.convertDeg(30));
The output is: "Degrees to radians: 0.5235987755982988"