-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSinCosTan.java
More file actions
47 lines (47 loc) · 839 Bytes
/
SinCosTan.java
File metadata and controls
47 lines (47 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class Sine extends Thread{
double angle;
double res;
Sine(double angle){
this.angle=Math.toRadians(angle);
}
public void run(){
res=Math.sin(angle);
}
}
class Cosine extends Thread{
double angle;
double res;
Cosine(double angle){
this.angle=Math.toRadians(angle);
}
public void run(){
res=Math.cos(angle);
}
}
class Tan extends Thread{
double angle;
double res;
Tan(double angle){
this.angle=Math.toRadians(angle);
}
public void run(){
res=Math.tan(angle);
}
}
class SinCosTan{
public static void main(String args[]){
double y;
Sine s=new Sine(45);
Cosine c=new Cosine(45);
Tan t=new Tan(45);
s.start();t.start();c.start();
try{
s.join();t.join();c.join();
}
catch(Exception e){
System.out.println("interrupted");
}
y=s.res+t.res+c.res;
System.out.println("sin+cos+tan "+y);
}
}