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; } }