在我科学型计算器java程序中怎样添加一个度数的功能,就是将数字转为度数,然后可以求三角函数,代码再发 5
elseif(e.getSource()==buttonOthers[scERATIONS.OP_sin.ordinal()]){z=Math.sin(Double.pa...
else if (e.getSource() == buttonOthers[scERATIONS.OP_sin.ordinal()])
{
z=Math.sin(Double.parseDouble(outputField.getText()));
str = String.valueOf(z);
outputField.setText(str);
}
else if (e.getSource() == buttonOthers[scERATIONS.OP_cos.ordinal()])
{
z=Math.cos(Double.parseDouble(outputField.getText()));
str = String.valueOf(z);
outputField.setText(str);
} 展开
{
z=Math.sin(Double.parseDouble(outputField.getText()));
str = String.valueOf(z);
outputField.setText(str);
}
else if (e.getSource() == buttonOthers[scERATIONS.OP_cos.ordinal()])
{
z=Math.cos(Double.parseDouble(outputField.getText()));
str = String.valueOf(z);
outputField.setText(str);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询