-1

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

Edited by Dani: Formatting fixed

Votes + Comments
Use code tags.
3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by kulrik
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.