-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjava.js
132 lines (116 loc) · 2.77 KB
/
java.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
function addNum(val){
quest.innerText += val;
disp.innerText= val;
}
function solve(){
ans.innerText= eval(quest.innerText);
disp.innerText= "=";
}
function del(){
quest.innerText= quest.innerText.slice(0,-1);
ans.innerText= "";
disp.innerText= "del";
}
function clr(){
quest.innerText= "";
ans.innerText= "";
}
function collectAns(){
quest.innerText=ans.innerText ;
ans.innerText="";
disp.innerText= "ans";
}
function root(){
ans.innerText= Math.sqrt(quest.innerText);
// quest.innerText= "√" + quest.innerText;
disp.innerText= "√";
}
function findPi(){
var pi = quest.innerText;
var mat = Math.PI * pi;
ans.innerText=mat;
// quest.innerText= "π" + quest.innerText;
disp.innerText= "π";
}
function squareOffTwo(){
ans.innerText=quest.innerText*quest.innerText;
disp.innerHTML= "X<sup>2</sup>";
}
function squareOffAny(){
ans.innerText=Math.pow(quest.innerText,quest.innerText);
disp.innerHTML= "X<sup>x</sup>";
}
function sin(e){
if(e.target.innerText== "SIN"){
ans.innerText= Math.sin(quest.innerText*Math.PI/180);
e.target.innerText= "asin";
disp.innerText= e.target.innerText;
}else if(e.target.innerText== "asin") {
ans.innerText= Math.asin(quest.innerText*Math.PI/180);
e.target.innerText= "SIN";
disp.innerText= e.target.innerText;
}
}
function cos(e){
if(e.target.innerText== "COS"){
ans.innerText= Math.cos(quest.innerText*Math.PI/180);
e.target.innerText= "acos";
disp.innerText= e.target.innerText;
}else if(e.target.innerText== "acos") {
ans.innerText= Math.acos(quest.innerText*Math.PI/180);
e.target.innerText= "COS";
disp.innerText= e.target.innerText;
}
}
function tan(e){
if(e.target.innerText== "TAN"){
ans.innerText= Math.tan(quest.innerText*Math.PI/180);
e.target.innerText= "atan";
disp.innerText= "tan";
}else if(e.target.innerText== "atan") {
ans.innerText= Math.atan(quest.innerText*Math.PI/180);
e.target.innerText= "TAN";
disp.innerText= "atan";
}
}
function ln(){
ans.innerText= Math.LN2 * quest.innerText;
disp.innerText= "ln";
}
function resArea(e){
e.target.disabled=true;
}
function exp(){
ans.innerText=Math.exp(quest.innerText);
disp.innerText= "exp";
}
function logBaseTen(){
ans.innerText= Math.log10(quest.innerText);
disp.innerHTML= "log<sub>2</sub>";
}
function logBaseTwo(){
ans.innerText= Math.log2(quest.innerText);
disp.innerHTML= "log<sub>2</sub>";
}
function round(){
ans.innerText= Math.round(quest.innerText);
disp.innerText= "round to n integer";
}
function convertm(e){
ans.innerText= quest.innerText*1000;
disp.innerText= "km-m";
}
function convertcm(e){
ans.innerText= quest.innerText*100000;
disp.innerText= "km-cm";
}
function offBtn(e){
quest.innerText="";
ans.innerText="";
disp.innerText= "off";
}
function onBtn(e){
ans.innerText="";
disp.innerText= "on";
}
// dat.innerText= Date();