With this problem. I finished the coding, but my output is displayed in Radians instead of Degrees. Can anyone help? Here's my coding:

public class MyMath 
{   
    public void displaySin()

    {   int angle = 0;
        System.out.println("Angle\tSin(Angle)\tValue");
        while(angle<=360){
            final double RADIANCONST=180;
            double angleRadian;
            angleRadian = Math.sin((RADIANCONST*angle)/RADIANCONST);
            System.out.printf("%d\tSin\t(%d)\t%5.2f\n",angle,angle, angleRadian);
            angle = angle + 30;
        }//end while
    }
public static void main(String[]args)
{
    MyMath m;
    m = new MyMath();
    m.displaySin();

}


}//end method
mvmalderen commented: Use code tags. -1

Recommended Answers

All 4 Replies

angle in degrees = angle in radians * 180 / Pi

Use that formula to fix the output. Or to fix the calculations in your code, wherever your miscalculations may be if you have any.

i tried that. where should I put it?

i tried that. where should I put it?

Show your try, then we can see what you did wrong.

Never Mind I Got It. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.