📄 exercise4_14.java
字号:
// Exercise4_14.java: Display sin and cos table
public class Exercise4_14 {
public static void main(String[] args) {
System.out.println("Degree\tSin\t\tCos");
for (int degree = 0; degree <= 360; degree += 10) {
System.out.println(degree + "\t" +
format(Math.sin(degree * Math.PI / 180), 4)
+ "\t\t" + format(Math.cos(degree * Math.PI / 180), 4));
}
}
public static double format(double d, int position) {
return Math.round(d * Math.pow(10, position)) / Math.pow(10, position);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -