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.
28 lines
786 B
28 lines
786 B
package ¼Ó¼õ³Ë³ý;
|
|
import java.util.*;
|
|
public class d {
|
|
String s;
|
|
double x;
|
|
public d(String s,double x)
|
|
{
|
|
this.s=s;
|
|
this.x=x;
|
|
}
|
|
public double sanjiao()
|
|
{
|
|
if (s.equals("sin")) return sin(x);
|
|
else if (s.equals("cos")) return cos(x);
|
|
else if (s.equals("tan")) return tan(x);
|
|
else if (s.equals("asin")) return asin(x);
|
|
else if (s.equals("acos")) return acos(x);
|
|
else if (s.equals("atan")) return atan(x);
|
|
else return Double.POSITIVE_INFINITY;
|
|
}
|
|
private double sin(double x) {return Math.sin(x);}
|
|
private double cos(double x) {return Math.cos(x);}
|
|
private double tan(double x) {return Math.tan(x);}
|
|
private double asin(double x) {return Math.asin(x);}
|
|
private double acos(double x) {return Math.acos(x);}
|
|
private double atan(double x) {return Math.atan(x);}
|
|
}
|