viernes, 25 de mayo de 2018

EJERCICIOS DE PROGRAMACION

TAREA DE LEONIDAS

1.- public static void main(String args[]) {
        int s1;

        Scanner teclado = new Scanner(System.in);

        System.out.println(" ingrese N°1 : ");
        s1 = teclado.nextInt();

        System.out.println(" el numero es multiplo de 3 y de 5, el resultado es "+ (s1*3) +  " y " + (s1*5 ) );

    }
2.- public static void main(String[] args) {
        int D;
        Scanner teclado = new Scanner(System.in);
        System.out.println("numero 1 :");
        D = teclado.nextInt();
       
        System.out.println(D + (D % 2 == 0 ? " ES PAR " + " SU DOBLE ES  "   : " ES IMPAR "+ " EL TRIPLE ES " ));
       
}

3.-  int s1,s2,s3;

       
        Scanner teclado = new Scanner(System.in);

        System.out.println(" ingrese N°1 : ");
        s1 = teclado.nextInt();
        System.out.println(" ingrese N°2 : ");
        s2 = teclado.nextInt();       
        System.out.println(" ingrese N°3 : ");
        s3 = teclado.nextInt();
       
        if(s1>s2 && s1>s3)
           
              System.out.println(" el mayor es " + s1);
       
        if(s2>s1 && s2>s3)
            System.out.println(" el mayor es " + s2);
       
        if(s3>s1 && s3>s2)
            System.out.println(" el mayor es " + s3);
       
        if(s3==s1 && s3==s2)
            System.out.println(" los numeros son iguales " +s1+" "+s2+" "+s3);
       
       
    }

4.-  public static void main(String[] args) {
        int D;
        Scanner teclado = new Scanner(System.in);
        System.out.println("numero 1 :");
        D = teclado.nextInt();
       
        System.out.println(D + (D % 2 == 0 ? " ES PAR " + " SU DOBLE ES  "   +(D*2) : " ES IMPAR "+ " EL TRIPLE ES " + D*3));
       
}


5.-
    public static void main(String[] args) {

        int a, b, c,mayor,menor,medio;
        Scanner teclado = new Scanner(System.in);
        System.out.println(" Ingrese valor de a: ");
        a = teclado.nextInt();
        System.out.println(" Ingrese valor de b: ");
        b = teclado.nextInt();
        System.out.println(" Ingrese valor de c: ");
        c = teclado.nextInt();
         
        if (a >b && a>c) {
            mayor=a;
            if(b>c){
                medio=b;
                menor=c;
            }
            else{
                medio=c;
                menor=b;
            }
        }
        else{
            if (b>a && b>c){
                mayor= b;
                if(a>c){
                    medio=a;
                    menor=b;
                }
                else{
                    medio=b;
                    menor=a;
                }
            }
            else{
                mayor=c;
                if(a>b){
                    medio=a;
                    menor=b;
                }
                else{
                    medio=b;
                    menor=a;
                }
            }
        }
        System.out.println("El numero mayor es :"+mayor);
        System.out.println("El orden de maroy a menor seria: "+mayor+" "+medio+" "+menor );


6.-
public static void main(String args[]) {
        int s1;

        Scanner teclado = new Scanner(System.in);

        System.out.println(" ingrese monto a pagar : ");
        s1 = teclado.nextInt();

        if (s1 <= 100) {
            System.out.println(" Tiene descuento del 10% en su consumo que es " + (s1 * 0.1) + " de " + " $ " + (s1));
           
        }

        if (s1 >= 100) {
           
            System.out.println(" Tiene descuento del 20% en su consumo que es  " +(s1*0.2)+ " de " + " $ " + (s1) );

7 .-
public static void main(String args[]) {
        double s1;

        Scanner teclado = new Scanner(System.in);

        System.out.println(" ingrese monto a pagar : ");
        s1 = teclado.nextDouble();

        if (s1 <= 100) {
            System.out.println(" Tiene descuento del 10% en su consumo que es " + (s1 * 0.1) + " de " + " $ " + (s1));

        }

        if (s1 >= 100 && s1 <= 200) {

            System.out.println(" Tiene descuento del 20% en su consumo que es  " + (s1 * 0.2) + " de " + " $ " + (s1));
        }
        if (s1 > 200) {

            System.out.println(" Tiene descuento del 30% en su consumo que es  " + (s1 * 0.3) + " de " + " $ " + (s1));

        }

    }

8 .-
  public static void main(String args[]) {
        double t;

        Scanner teclado = new Scanner(System.in);

        System.out.println(" Valor de Temperatura : ");
        t = teclado.nextDouble();

        if (t <= 10) {
            System.out.println(" Temperatura del ambiente Fria ");

        }

        if (t > 10 && t <= 20) {

            System.out.println(" Temperatura del ambiente Nublado ");
        }
        if (t > 21 && t <= 30 ) {

            System.out.println( " Temperatura del ambiente Carlo " );

        }
     
        if (t > 30 ) {

            System.out.println( " Temperatura del ambiente Tropical " );

        }

    }

9 .-
    public static void main(String[] args) {

        String tc;
        double mon;
        Scanner teclado = new Scanner(System.in);

        System.out.println(" Ingrese tipo de cliente : ");
        tc = teclado.nextLine();

        System.out.println(" Ingrese monto a pagar : ");
        mon = teclado.nextDouble();

        if (tc.equals(" g ")) {
            System.out.println(" Monto a pagar del cliente es ");
            System.out.println(" descuento a pagar " + (mon * 0.15) + mon);
            System.out.println(" Plazos a pagar " + ((mon * 0.1) + mon));

        }
         if (tc.equals(" a ")) {
            System.out.println(" Monto a pagar del cliente es ");
            System.out.println(" descuento a pagar " + (mon * 0.2));
            System.out.println(" Plazos a pagar " + ((mon * 0.05) + mon));
        }
         
     
    }

10.-
public static void main(String args[]) {

            double x,a,b;
           
           
        Scanner teclado = new Scanner(System.in);

        System.out.println(" ingrese N°1 : ");
        x = teclado.nextInt();
        System.out.println(" ingrese N°2 : ");
        a = teclado.nextInt();
        System.out.println(" ingrese N°2 : ");
        b = teclado.nextInt();
       
        b=a*x;
        System.out.println(" el resultado de la ecuacion del primer grado es = " +b);
       
        x=(-b)/a;
        System.out.println(" el resultado de la ecuacion del primer grado es = " +x);
     
        }
11.-public static void main(String[] args) {

        double a, b, c, x1, x2, valor;
        Scanner teclado = new Scanner(System.in);
        System.out.println(" Ingrese valor de a: ");
        a = teclado.nextInt();
        System.out.println(" Ingrese valor de b: ");
        b = teclado.nextInt();
        System.out.println(" Ingrese valor de c: ");
        c = teclado.nextInt();
        valor=b*b-4*a*c;   
        if (a != 0) {
            if(valor!=0){
                x1=(-b+Math.sqrt(valor))/(2*a);
                x2=(-b-Math.sqrt(valor))/(2*a);
                System.out.println("El valor de X1 es: "+x1);
                System.out.println("El valor de X2 es: "+x2);
            }
            else{
                System.out.println("b*b-4*a*c es igual a cero");
            }
               
        }
        else{
            System.out.println("a es igual a cero");
        }
    }
12.-
 public static void main(String[] args) {
       
        int h,m,s;
       
        Scanner teclado=new java.util.Scanner(System.in);
        System.out.println("ingresar hora: ");
        h=teclado.nextInt();
        System.out.println("ingreasr minuto: ");
        m=teclado.nextInt();
        System.out.println("ingreasar segundo: ");
        s=teclado.nextInt();
       
        s=s+1;
        if (s<61){
            s=0;
        }
        m=m+1;
        if (m<61){
            m=0;
        }   
        h=h+1;
        if (h<=25){
            h=0;
        }
        System.out.println("");
        System.out.println("la hora es: "+h);
        System.out.println("el minuto es: "+m);
        System.out.println("el segundo es: "+s);
    }
           

No hay comentarios:

Publicar un comentario

DESARROLLO DE METODOLOGIAS DE SOFTWARE

El desarrollo de software, ha ido evolucionando constantemente en las metodologías o maneras en las cuales se realiza la planeación para e...