преобразовать градус в радиан

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class math
{
    JFrame jf;
    JTextField jt;
    JButton jb;
    JButton jb1;
    math()
    {
        jf=new JFrame("frame");
        jf.setSize(200,200);
        jf.setVisible(true);
        jt=new JTextField(50);
        jf.setLayout(new FlowLayout());
        JButton jb=new JButton("30");
        JButton jb1=new JButton("sin");
        jb.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent ae)
            {
                jt.setText("90");
            }
        });
        jb1.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent ae)
            {
                String s=jt.getText();
                float x=Float.parseFloat(s);
                double s1=Math.sin(x);
                String s2=String.valueOf(s1);
                jt.setText(s2);
            }
        });
        JButton jb2=new JButton("cos");
        jf.add(jt);
        jf.add(jb);
        jf.add(jb1);
        jf.add(jb2);
    }
    public static void main(String args[])
    {
        new math();
    }
}
//output errors=sin(90)=0.89999 and sin(any angle) is coming incorrect

Ответы на вопрос(0)

Ваш ответ на вопрос