UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Resuelto 21



21.- AL INGRESAR EL VALOR DE UNA TEMPERATURA, OBTENER EL TIPO DE CLIMA SEGÚN DETALLE:


TEMPERATURA
TIPO DE CLIMA
TEMP. < 10
TEMP. ENTRE 10 Y 20
TEMP. ENTRE 21 Y 30
TEMP. > 30
FRIO
NUBLADO
CALOR
TROPICAL

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema021;
import java.io.*;
/**
 *
 * @author abel montalvan
 */
public class Problema021 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)throws IOException{ 
       int t;
       String c;
 BufferedReader in=new BufferedReader(new  InputStreamReader(System.in));
 System.out.println("Temperatura: ");
 t = Integer.parseInt(in.readLine());
 if (t<10)
 {
     c="FRIO";
 }
 else
 {
     if (t>9 && t<21)
     {
         c="NUBLADO";
     }
     else
     {
         if (t>=21 && t<=30)
         {
             c="CALOR";
         }
         else
         {
             c="TROPICAL";
         }
     }
 }
       System.out.println("");
       System.out.println("Clima: " + c);
       System.out.println();
    }
}

No hay comentarios:

Publicar un comentario