Muestra la nota media con decimales


 Programa que lee una calificación con decimales entre 0 y 10, y la transforma en nota alfabética según la siguiente tabla:

Nota num. Nota alfa.

0 <= n <3 Muy deficiente
3 <= n <5 Insuficiente
5 <= n <6 Suficiente
6 <= n <7 Bien
7 <= n <9 Notable
9 <= n <= 10 Excelente

  1.    import cs1.Keyboard;
  2.    public class ejerc1
  3.    {
  4.       public static void main (String[] args)
  5.       {
  6.       //Variables
  7.          double nota;
  8.      
  9.       //Introduci—n de la nota
  10.          System.out.print( "Introduce la nota con decimales:" );
  11.          nota = Keyboard.readDouble();
  12.      
  13.       //Comparaci—n
  14.          if (nota <= 3) {
  15.             System.out.print ( "Muy Deficiente" );
  16.          }
  17.          else {
  18.             if ( 3 <= nota & nota < 5 ) {
  19.                System.out.println ( "Insuficiente" );
  20.             }
  21.             else {
  22.                if ( 5 <= nota & nota < 6 ) {
  23.                   System.out.println ( "Suficiente" );
  24.                }
  25.                else {
  26.                   if ( 6 <= nota & nota < 7 ) {
  27.                      System.out.println ( "Bien" );
  28.                   }
  29.                   else {
  30.                      if ( 7 <= nota & nota < 9 ) {
  31.                         System.out.println ( "Notable" );
  32.                      }
  33.                      else {
  34.                         if ( 9 <= nota & nota <= 10 ){
  35.                            System.out.println ( "Excelente" );
  36.                         }
  37.                         else {
  38.                            System.out.println ( "La nota es demasiado grande" );
  39.                         }
  40.                      }
  41.                   }
  42.                }
  43.             }
  44.          }
  45.       }
  46.    }

No hay comentarios:

Publicar un comentario