Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first commit #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bggg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Audiowide">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>
<body>
<div id="container">
<div id="calculator">


<form name="sci-calc">
<table class="calculator" cellspacing="0" cellpadding="1">
<tr>
<td colspan="4" class="requiredCol "><input id="display" name="display" value="0" size="50" maxlength="25"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnTop" value="C" onclick="this.form.display.value= 0 "></td>
<td><input type="button" class="number" name="btnTop" value="<" onclick="deleteChar(this.form.display)"></td>
<td><input type="button" class="number" name="btnTop" value="=" onclick="if(checkNum(this.form.display.value)) { compute(this.form) }"></td>
<td><input type="button" class="number" name="btnOpps" value="&#960;" onclick="addChar(this.form.display,'3.14159265359')"></td>
<td><a href="index2.html"><input type="button" class="number" name="btnMath" value="rad" ></a></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnNum" value="7" onclick="addChar(this.form.display, '7')"></td>
<td><input type="button" class="number" name="btnNum" value="8" onclick="addChar(this.form.display, '8')"></td>
<td><input type="button" class="number" name="btnNum" value="9" onclick="addChar(this.form.display, '9')"></td>
<td><input type="button" class="number" name="btnOpps" value="x&#94;" onclick="if(checkNum(this.form.display.value)) { exp(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="/" onclick="addChar(this.form.display, '/')"></td>
<tr>
<td><input type="button" class="number" name="btnNum" value="4" onclick="addChar(this.form.display, '4')"></td>
<td><input type="button" class="number" name="btnNum" value="5" onclick="addChar(this.form.display, '5')"></td>
<td><input type="button" class="number" name="btnNum" value="6" onclick="addChar(this.form.display, '6')"></td>
<td><input type="button" class="number" name="btnOpps" value="ln" onclick="if(checkNum(this.form.display.value)) { ln(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="*" onclick="addChar(this.form.display, '*')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnNum" value="1" onclick="addChar(this.form.display, '1')"></td>
<td><input type="button" class="number" name="btnNum" value="2" onclick="addChar(this.form.display, '2')"></td>
<td><input type="button" class="number" name="btnNum" value="3" onclick="addChar(this.form.display, '3')"></td>
<td><input type="button" class="number" name="btnOpps" value="&radic;" onclick="if(checkNum(this.form.display.value)) { sqrt(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="-" onclick="addChar(this.form.display, '-')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnMath" value="&#177" onclick="changeSign(this.form.display)"></td>
<td><input type="button" class="number" name="btnNum" value="0" onclick="addChar(this.form.display, '0')"></td>
<td><input type="button" class="number" name="btnMath" value="&#46;" onclick="addChar(this.form.display, '&#46;')"></td>
<td><input type="button" class="number" name="btnOpps" value="x&#50;" onclick="if(checkNum(this.form.display.value)) { square(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="+" onclick="addChar(this.form.display, '+')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnMath" value="(" onclick="addChar(this.form.display, '(')"></td>
<td><input type="button" class="number" name="btnMath" value=")" onclick="addChar(this.form.display,')')"></td>
<td><input type="button" class="number" name="btnMath" value="cos" onclick="if(checkNum(this.form.display.value)) { cos(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="sin" onclick="if(checkNum(this.form.display.value)) { sin(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="tan" onclick="if(checkNum(this.form.display.value)) { tan(this.form) }"></td>
</tr>
</tabel>
</form>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
65 changes: 65 additions & 0 deletions index2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Audiowide">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>
<body>
<div id="container">
<div id="calculator">


<form name="sci-calc">
<table class="calculator" cellspacing="0" cellpadding="1">
<tr>
<td colspan="4" class="requiredCol "><input id="display" name="display" value="0" size="50" maxlength="25"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnTop" value="C" onclick="this.form.display.value= 0 "></td>
<td><input type="button" class="number" name="btnTop" value="<" onclick="deleteChar(this.form.display)"></td>
<td><input type="button" class="number" name="btnTop" value="=" onclick="if(checkNum(this.form.display.value)) { compute(this.form) }"></td>
<td><input type="button" class="number" name="btnOpps" value="&#960;" onclick="addChar(this.form.display,'3.14159265359')"></td>
<td><a href="index.html"><input type="button" class="number" name="btnMath" value="deg" ></a></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnNum" value="7" onclick="addChar(this.form.display, '7')"></td>
<td><input type="button" class="number" name="btnNum" value="8" onclick="addChar(this.form.display, '8')"></td>
<td><input type="button" class="number" name="btnNum" value="9" onclick="addChar(this.form.display, '9')"></td>
<td><input type="button" class="number" name="btnOpps" value="x&#94;" onclick="if(checkNum(this.form.display.value)) { exp(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="/" onclick="addChar(this.form.display, '/')"></td>
<tr>
<td><input type="button" class="number" name="btnNum" value="4" onclick="addChar(this.form.display, '4')"></td>
<td><input type="button" class="number" name="btnNum" value="5" onclick="addChar(this.form.display, '5')"></td>
<td><input type="button" class="number" name="btnNum" value="6" onclick="addChar(this.form.display, '6')"></td>
<td><input type="button" class="number" name="btnOpps" value="ln" onclick="if(checkNum(this.form.display.value)) { ln(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="*" onclick="addChar(this.form.display, '*')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnNum" value="1" onclick="addChar(this.form.display, '1')"></td>
<td><input type="button" class="number" name="btnNum" value="2" onclick="addChar(this.form.display, '2')"></td>
<td><input type="button" class="number" name="btnNum" value="3" onclick="addChar(this.form.display, '3')"></td>
<td><input type="button" class="number" name="btnOpps" value="&radic;" onclick="if(checkNum(this.form.display.value)) { sqrt(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="-" onclick="addChar(this.form.display, '-')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnMath" value="&#177" onclick="changeSign(this.form.display)"></td>
<td><input type="button" class="number" name="btnNum" value="0" onclick="addChar(this.form.display, '0')"></td>
<td><input type="button" class="number" name="btnMath" value="&#46;" onclick="addChar(this.form.display, '&#46;')"></td>
<td><input type="button" class="number" name="btnOpps" value="x&#50;" onclick="if(checkNum(this.form.display.value)) { square(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="+" onclick="addChar(this.form.display, '+')"></td>
</tr>
<tr>
<td><input type="button" class="number" name="btnMath" value="(" onclick="addChar(this.form.display, '(')"></td>
<td><input type="button" class="number" name="btnMath" value=")" onclick="addChar(this.form.display,')')"></td>
<td><input type="button" class="number" name="btnMath" value="cos" onclick="if(checkNum(this.form.display.value)) { cos(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="sin" onclick="if(checkNum(this.form.display.value)) { sin(this.form) }"></td>
<td><input type="button" class="number" name="btnMath" value="tan" onclick="if(checkNum(this.form.display.value)) { tan(this.form) }"></td>
</tr>
</tabel>
</form>
</div>
</div>
<script src="script1.js"></script>
</body>
</html>
70 changes: 70 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}

function cos(form) {
form.display.value = Math.cos(form.display.value*Math.PI/180);
}

function sin(form) {
form.display.value = Math.sin(form.display.value*Math.PI/180);
}

function tan(form) {
form.display.value = Math.tan(form.display.value*Math.PI/180);
}

function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);
}

function ln(form) {
form.display.value = Math.log(form.display.value);
}

function exp(form) {
form.display.value = Math.exp(form.display.value);
}

function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}
var val = 0.0;
function percent(input) {
val = input.value;
input.value = input.value + "%";
}

function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}

function compute(form) {

form.display.value = eval(form.display.value);
}


function square(form) {
form.display.value = eval(form.display.value) * eval(form.display.value)
}

function checkNum(str) {
for (var i = 0; i < str.length; i++) {
var ch = str.charAt(i);
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch != "-" && ch != "."
&& ch != "(" && ch!= ")" && ch != "%") {
alert("invalid entry!")
return false
}
}
}
return true
}
70 changes: 70 additions & 0 deletions script1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}

function cos(form) {
form.display.value = Math.cos(form.display.value);
}

function sin(form) {
form.display.value = Math.sin(form.display.value);
}

function tan(form) {
form.display.value = Math.tan(form.display.value);
}

function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);
}

function ln(form) {
form.display.value = Math.log(form.display.value);
}

function exp(form) {
form.display.value = Math.exp(form.display.value);
}

function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}
var val = 0.0;
function percent(input) {
val = input.value;
input.value = input.value + "%";
}

function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}

function compute(form) {

form.display.value = eval(form.display.value);
}


function square(form) {
form.display.value = eval(form.display.value) * eval(form.display.value)
}

function checkNum(str) {
for (var i = 0; i < str.length; i++) {
var ch = str.charAt(i);
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch != "-" && ch != "."
&& ch != "(" && ch!= ")" && ch != "%") {
alert("invalid entry!")
return false
}
}
}
return true
}
92 changes: 92 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
body{
font-family: "Audiowide", sans-serif;
background-color: black;
}


.requiredCol {
width: 2px;
border: 2px solid rgb(15, 3, 3);
margin: -2px;
}
#container{
width: 1256px;
height:555px;
background-image: linear-gradient(rgba(0,0,0,0.3),rgba(0,0,0,0.3)), url('bggg.jpg');

background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
#calculator{
width: 460px;
height: 520px;
background: rgba(90, 92, 90, 0.3);
margin: 0 auto;
top: 20px;
position: relative;
border-radius: 5px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.7), 0 6px 20px 0 rgba(0, 0, 0, 0.5);
}
#result{
height: 120px;
}
#history{
text-align: right;
height: 20px;
margin: 0 20px;
padding-top: 20px;
font-size: 15px;
color: #919191;
}
#output{
text-align: right;
height: 60px;
margin: 10px 20px;
font-size: 30px;
}
#keyboard{
height: 400px;
}
.operator, .number, .empty{
width: 50px;
height: 50px;
margin: 15px;
float: left;
border-radius: 50%;
border-width: 0;
font-weight: bold;
font-size: 15px;
}
.number, .empty{
background-color: #eaedef;
}
.number, .operator{
cursor: pointer;
}
.operator:active, .number:active{
font-size: 13px;
}
.operator:focus, .number:focus, .empty:focus{
outline: 0;
}
button:nth-child(4){
font-size: 20px;
background-color: #686969;
}
button:nth-child(8){
font-size: 20px;
background-color:#686969;
}
button:nth-child(12){
font-size: 20px;
background-color: #686969;
}
button:nth-child(16){
font-size: 20px;
background-color:#686969;
}
button:nth-child(20){
font-size: 20px;
background-color: #686969;
}