Last active
December 19, 2019 11:06
-
-
Save rogersguedes/69f7f4cfeb06c75e848120a0316b48ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.uel.br/projetos/matessencial/superior/calculo/cilide/cilide00.htm | |
// http://www.uel.br/projetos/matessencial/superior/calculo/cilide/cilide00.js | |
function testa_entrada(form, button) {calcula_volume(form);return;} | |
// r = raio da base do cilindro, h = altura do liquido | |
// L = comprimento do cilindro, A = área e V = volume | |
function calcula_volume(form) { | |
if(form.entrada1.value=="" || form.entrada1.value==" " || form.entrada1.value=="0" || form.entrada2.value=="" || form.entrada2.value==" " || form.entrada2.value=="0" || form.entrada3.value=="" || form.entrada3.value==" " || form.entrada3.value=="0") | |
{alert("Existe alguma medida nula. Preencha as caixas de modo correto."); | |
return; | |
} | |
var r=parseFloat(form.entrada1.value); | |
var L=parseFloat(form.entrada2.value); | |
var h=parseFloat(form.entrada3.value); | |
var p=Math.PI; | |
var d=h-r; | |
var q=Math.asin(-d/r); | |
var w=Math.sqrt(r*r-d*d); | |
var A=p*r*r/2-r*r*q +d*w; | |
var V=A*L/1000; | |
{form.saida1.value=A;form.saida2.value=V;return;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment