You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package guangzhaowei;
|
|
|
|
|
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
|
|
|
|
|
public class Triangle {
|
|
|
|
|
public static void angle(){
|
|
|
|
|
Scanner sc= new Scanner(System.in);
|
|
|
|
|
System.out.println("<22><><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>");
|
|
|
|
|
String b=sc.next();
|
|
|
|
|
System.out.println("<22><>ֵ<EFBFBD><D6B5>");
|
|
|
|
|
double a=sc.nextDouble();
|
|
|
|
|
double c = Math.toRadians(a);
|
|
|
|
|
if (a % 180 == 0 && b.equals("sin")) {
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0");
|
|
|
|
|
}
|
|
|
|
|
if (a % 90 == 0 && a % 180 != 0 && b.equals("cos")) {
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (b) {
|
|
|
|
|
case "cos":
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+Math.cos(c));
|
|
|
|
|
break;
|
|
|
|
|
case "sin":
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+Math.sin(c));
|
|
|
|
|
break;
|
|
|
|
|
case "tan":
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+Math.tan(c));
|
|
|
|
|
break;
|
|
|
|
|
case "cot":
|
|
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+1 / Math.tan(c));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|