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.
24 lines
584 B
24 lines
584 B
4 years ago
|
public class d {
|
||
|
public static double angle(double a, String b) {
|
||
|
double c = Math.toRadians(a);
|
||
|
if (a % 180 == 0 && b.equals("sin")) {
|
||
|
return 0;
|
||
|
}
|
||
|
if (a % 90 == 0 && a % 180 != 0 && b.equals("cos")) {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
switch (b) {
|
||
|
case "cos":
|
||
|
return Math.cos(c);
|
||
|
case "sin":
|
||
|
return Math.sin(c);
|
||
|
case "tan":
|
||
|
return Math.tan(c);
|
||
|
case "cot":
|
||
|
return 1 / Math.tan(c);
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
}
|