commit
b19301b9fd
@ -0,0 +1,27 @@
|
||||
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);}
|
||||
}
|
Loading…
Reference in new issue