Skip to content
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 Capture.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<html>

<head>
<title>Worlds Best Calculator</title>
<style>
</style>

<title>Basic Calculator</title>

<!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
Expand All @@ -17,10 +20,24 @@
// hint: these are strings
var numberOne = document.forms.inputs.numberOne.value;
var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = numberOne + numberTwo;
document.forms.inputs.result.value = parseFloat(numberOne) + parseFloat(numberTwo);
},
subtractNumbers: function () {
var numberOne = document.forms.inputs.numberOne.value;
var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = parseFloat(numberOne) - parseFloat(numberTwo);

},
divideNumbers: function () {
var numberOne = document.forms.inputs.numberOne.value;
var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = parseFloat(numberOne) / parseFloat(numberTwo);

},
multiplyNumbers: function () {
var numberOne = document.forms.inputs.numberOne.value;
var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = parseFloat(numberOne) * parseFloat(numberTwo);
}
}

Expand All @@ -29,7 +46,7 @@
</head>

<body>
<div>Header</div>
<div>Basic Calculator</div>
<div>
<!--
- allow two numbers to be entered
Expand All @@ -47,7 +64,9 @@
</div>
<div>
<button type="button" class="btn btn-primary" onclick="calculator.addNumbers()" >Add</button>
<button type="button" class="btn btn-primary">Substract</button>
<button type="button" class="btn btn-primary" onclick="calculator.subtractNumbers()" >Subtract</button>
<button type="button" class="btn btn-primary" onclick="calculator.divideNumbers()" >Divide</button>
<button type="button" class="btn btn-primary" onclick="calculator.multiplyNumbers()" >Multiply</button>
</div>
<div>
<input name="result" value="0" class="form-control" disabled />
Expand All @@ -56,7 +75,7 @@


</div>
<div>Footer</div>
<div>Good Luck..!!!</div>


</body>
Expand Down