diff --git a/WebDev.md b/WebDev.md index cb78c5f..87310f4 100644 --- a/WebDev.md +++ b/WebDev.md @@ -53,3 +53,5 @@ Remember, the deadline for this week's task is June 7th, 2022, at 23:59. + +Ankit Kansal - [calculator](https://github.com/ankit-kansal/CSOC22-Week1)[Site](www.copsiitbhu.co.in) diff --git a/calculator/index.html b/calculator/index.html new file mode 100644 index 0000000..c245a0e --- /dev/null +++ b/calculator/index.html @@ -0,0 +1,65 @@ + + + calculator + + + + +
+
Calculator
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

History:

+ +
+ + + \ No newline at end of file diff --git a/calculator/script.js b/calculator/script.js new file mode 100644 index 0000000..9603468 --- /dev/null +++ b/calculator/script.js @@ -0,0 +1,56 @@ +function display(a){ + document.getElementById("scrn").value+=a; +} +function clearAll(){ + document.getElementById("scrn").value=""; +} +let s=""; +function calculate(){ + s+=document.getElementById("scrn").value; + s+='='; + document.getElementById("scrn").value=eval(document.getElementById("scrn").value); + s+=document.getElementById("scrn").value; + s+='\n'; +} +function cut(){ + let a=document.getElementById("scrn").value; + document.getElementById("scrn").value=a.slice(0,a.length-1) +} +let d=0; +function sinD(angleDegrees) { + return Math.sin(angleDegrees*Math.PI/180); +}; +function cosD(angleDegrees) { + return Math.cos(angleDegrees*Math.PI/180); +}; +function tanD(angleDegrees) { + return Math.tan(angleDegrees*Math.PI/180); +}; +function sin(a){ + if(d===1)return sinD(a); + else { + return Math.sin(a); + } +} +function cos(a){ + if(d===1)return cosD(a); + else return Math.cos(a); +} +function tan(a){ + if(d===1)return tanD(a); + else return Math.tan(a); +} +function change(){ + if(d==1){ + d=0; + document.getElementById("btn1").value="deg"; + } + else { + d=1; + document.getElementById("btn1").value="rad"; + } +} +function history(){ + document.getElementById("his").innerHTML=s; +} + diff --git a/calculator/styles.css b/calculator/styles.css new file mode 100644 index 0000000..c0c8d02 --- /dev/null +++ b/calculator/styles.css @@ -0,0 +1,75 @@ +#btn{ + padding: 15; + font-size: 30; + width: 100%; + background-color: rgb(214, 234, 252); + border: 0px; +} +#btn1{ + padding: 15; + font-size: 30; + width: 100%; + background-color: rgb(214, 234, 252); + border: 0px; +} +#scrn{ + padding: 20px; + font-size: large; + background-color: rgb(99, 99, 99); + color: white; + text-align: right; +} +table{ + padding: 60px; + border: 2px solid; + background-color: rgb(32, 108, 128); + margin-top: 40px; +} +body{ + background-color: rgb(229, 242, 254); +} +#his{ + font-size: x-large; +} +header{ + background-color: rgb(32, 108, 128); + display: inline-block; + padding: 20px; + color: aliceblue; + margin: 10px; + padding-left: 60px; + padding-right: 60px; + font-size: 50px; +} +@media only screen and (max-width: 1000px) { + table{ + margin: 0px; + margin-top: 40px; + } + #btn{ + padding: 25; + font-size: 55; + width: 100%; + background-color: rgb(214, 234, 252); + border: 0px; + + } + #btn1{ + padding: 25; + font-size: 55; + width: 100%; + background-color: rgb(214, 234, 252); + border: 0px; + + } + #scrn{ + padding: 30px; + font-size: xx-large; + background-color: rgb(99, 99, 99); + color: white; + } + #his{ + font-size: xx-large; + s=""; + } +}