miércoles, 9 de noviembre de 2016

FARENHEIT-CELCIUS 

JAVA VS HASKELL VS JAVASCRIPT

========================
Codigo JAVA:

package grados.a.farenheint;
import javax.swing.JOptionPane;
// * @author Junior
public class GradosAFarenheint {
public static void main(String[] args) {

double valor1, valor2, convers1, convers2;
int op=Integer.parseInt(JOptionPane.showInputDialog(null,"Escribe Un Valor De Temperatura\n1.- Grados Celcius a Farenheint\n2.- Grados Farenheit a Celsius","CONVIRTIENDO TEMPERATURA",JOptionPane.INFORMATION_MESSAGE));
   
switch (op)
{
       
case 1:
       valor1=Integer.parseInt(JOptionPane.showInputDialog(null,"Inseta Un Dato En Grados Celcius"));
       convers1=valor1*1.8+32;
       JOptionPane.showMessageDialog(null,"Grados Farenheit:\n"+convers1,"CONVIRTIENDO TEMPERATURA",JOptionPane.INFORMATION_MESSAGE);
       break;
          
case 2:
       valor2=Integer.parseInt(JOptionPane.showInputDialog(null,"Inseta Un Dato"));
       convers2=valor2-32/1.8;
       JOptionPane.showMessageDialog(null,"Grados Celcius:\n"+convers2,"CONVIRTIENDO TEMPERATURA",JOptionPane.INFORMATION_MESSAGE);
       break;
}}}






========================
Codigo HASKELL:

conversionaFarenheit celcius = 9/5*celcius+32
conversionaCelcius farenheit =farenheit-32/1.8 



========================


Codigo JAVASCRIPT:

function temperaturaCelcius(){
farenheit=prompt("Dame la temperatura en grados farenheit");
aCelcius=farenheit-32/1.8;
alert("Tu temperatura en grados Celcius es:\n"+aCelcius);
}

function temperaturaFarenheit(){
celcius=prompt("Dame la temperatura en grados Celcius");
aFarenheit=9/5*celcius+32;
alert("Tu temperatura en grados Farenheit es:\n"+aFarenheit);
}













No hay comentarios.:

Publicar un comentario