Bueno me mandaron esta tarea pero bueno es bien simple, espero me dejen algun mensaje aver como mejorarla y que mas puedo aprender asi mejorar mi codigo, un saludoi familia



Código: Seleccionar todo

import java.util.*;

public class conv
{
public static void main ( String [] args)
    {

      System.out.println("\t\t\t MENU\n\n\n");
      System.out.println("Que Convertidor quiere usar?\n\nSeleccione el numero correspondiente\n\n");
      System.out.println("1.Farhenheit\n\n");
      System.out.println("2.Kelvin\n\n");
      Scanner sc = new Scanner(System.in);
      int val = sc.nextInt();
      
      
      if(val!=1 && val!=2)
        System.out.println("Seleccion del menu no permitida \n\n\t\t Error Nº666 ¬¬");
      double cel;

       do{
      System.out.println("Ingrese sus grados Celsius");
      cel= sc.nextDouble();
      }while(cel>273.15);

       
       double total;
       if(val==1)
      {
        total = cel*9/5+32;
        System.out.println("Sus grados Farhenheit son :"+total);
      }
      else
      {
        if(val==2)
        {
        total= cel + 273.15;
        System.out.println("Sus grados Kelvin son :"+total);
        }
      }
    }
}

Byee
~C0D1NG~
"C, Java, C#, ASP.NET...."
Imagen
Responder

Volver a “Otros lenguajes”