Skip to content

Commit

Permalink
Adding files
Browse files Browse the repository at this point in the history
  • Loading branch information
luisgbr1el authored Nov 6, 2021
1 parent 43057ec commit e234eee
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 0 deletions.
Binary file added android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added favicon.ico
Binary file not shown.
Binary file added images/bhaskara.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Bhaskara Calculator</title>
<link rel="stylesheet" type="text/css" href="styles/index.css">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<center>
<!-- <img id="bhaskaraImage" src="images/bhaskara.png" width="150px" style="margin-top: 10px;"> -->
<h1 id="title">Bhaskara Calculator</h1>

<input type="number" id="a" placeholder='Valor "A"'></input>
<input type="number" id="b" placeholder='Valor "B"'></input>
<input type="number" id="c" placeholder='Valor "C"'></input>
= 0 <br> <br>
<button id="calc" style="cursor: pointer;" onclick="Calculate()">Calcular</button> <button style="cursor: pointer;" onclick="window.location.reload()">Limpar</button>
<p id="calculosDelta"></p>
<p id="delta"></p>
<p id="bhaskara"></p>

</center>
</body>
<script type="text/javascript" src="scripts/index.js"></script>
<footer>
<center>
Made by <a href="https://github.com/luisgbr1el" target="_blank">Luis Gabriel</a>
</center>
</footer>
</html>
62 changes: 62 additions & 0 deletions scripts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

// (function () { // Auto-start function

// }());


function Calculate() {
var a = parseFloat(document.getElementById("a").value);
var b = parseFloat(document.getElementById("b").value);
var c = parseFloat(document.getElementById("c").value);


var delta = (b * b) - (4 * a * c);

var x1 = -(b) + Math.sqrt(delta);
var x2 = -(b) - Math.sqrt(delta);

var produtoRaizes = x1 * x2;

$("#calculosDelta").fadeOut(function() {
$("#calculosDelta").html("Δ = " + b + "² - 4 * " + a + " * " + c).fadeIn(500);
});

//document.getElementById("delta").innerHTML = ;
$("#delta").fadeOut(function() {
$("#delta").html("Δ = " + delta).fadeIn(1000);
});


if (delta > 0) {
//document.getElementById("bhaskara").innerHTML =

$("#bhaskara").fadeOut(function() {
$("#bhaskara").html("X¹ = " + x1 + "<br>X² = " + x2).fadeIn(2000);
});

} else if (delta < 0) {
$("#bhaskara").fadeOut(function() {
$("#bhaskara").html("Como o valor de delta é negativo, não existem <b>raízes reais</b> (ℝ) para este número.").fadeIn(2000);
});
} else if (delta == 0) {
$("#bhaskara").fadeOut(function() {
$("#bhaskara").html("Como Δ = 0, a equação possui uma única <b>solução real</b>. (ℝ)").fadeIn(2000);
});
}

if (document.getElementById("a").value.length == 0 || document.getElementById("b").value.length == 0 || document.getElementById("c").value.length == 0) {
alert("Preencha todos os campos!")
//window.location.reload()
document.getElementById("delta").innerHTML = "Δ = indefinido";
}


//console.log(delta);



//console.log("X¹ = " + x1 + "\nX² = " + x2);



}
1 change: 1 addition & 0 deletions site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
62 changes: 62 additions & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
html, body {
font-family: 'Quicksand', sans-serif;
color: white;
background-color: #36393f;
height: 90%;
margin: 0;
font-size: 18pt;
}
h1 {
font-size: 35pt;
stroke: black;
}
center {
padding: 0;
min-height: 100%;
margin: 0 auto 50px;
}
input#a, input#b, input#c {
width: 90px;
outline: none;
border-radius: 5px;
padding: 10px;
border: none;
transition: 0.1s;
font-size: 14pt;
font-family: 'Quicksand', sans-serif;
}
input#a:hover, input#b:hover, input#c:hover {
background-color: rgb(220,220,220);
transition: 0.1s;
}

button {
border: none;
background-color: #36393f;
color: white;
padding: 10px;
font-weight: bold;
font-size: 12pt;
border-radius: 5px;
transition: 0.1s;
font-family: 'Quicksand', sans-serif;
}
button:hover {
background-color: #46494f;
color: white;
transition: 0.1s;
}

footer {
height: 10px;
font-size: 10pt;
}

a {
color: white;
font-weight: bolder;
}

p#delta {
font-size: 26pt;
}

0 comments on commit e234eee

Please sign in to comment.