lunes, 9 de abril de 2012

PROMEDIO DE NOTAS
package notas;
import java.util.*;
/**
 *
 * @author Sebastian Pinilla
 */
public class Notas {

    public static void main(String[] args) {
        Scanner stdin=new Scanner(System.in); //Metodo de lectura
        System.out.println("Introduzca las cinco notas.Use ,");
        System.out.println("Introduzca la primera nota");
        double not1=stdin.nextDouble();
        System.out.println("Introduzca la segunda nota");
        double not2=stdin.nextDouble();
        System.out.println("Introduzca la tercera nota");
        double not3=stdin.nextDouble();
        System.out.println("Introduzca la cuarta nota");
        double not4=stdin.nextDouble();
        System.out.println("Introduzca la quinta nota");
        double not5=stdin.nextDouble();
        Promedio Final = new Promedio(not1,not2,not3,not4,not5);
        System.out.println("La nota final del semestre es:" +Final.promedio());
        // TODO code application logic here
    }
   
}
class Promedio

{
private double not1,not2,not3,not4,not5;
public Promedio(double N1,double N2,double N3,double N4,double N5){//Constructor
    not1=N1;
    not2=N2;
    not3=N3;
    not4=N4;
    not5=N5;
}
public double promedio(){
    double Prom;
    Prom=(not1+not2+not3+not4+not5)*0.1;
    return Prom;
   
   
}
}//Fin de la clase Promedio
SUMA DE 4 NUMEROS
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package suma.de.pkg4.numeros;
import java.util.*;
/**
 *
 * @author Sebastian Pinilla
 */
public class SumaDe4Numeros {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner stdin=new Scanner(System.in);//Metodo para lectura
        System.out.println("Digite el primer numero");
        System.out.println("Digite el segundo numero");
        System.out.println("Digite el tercer numero");
        System.out.println("Digite el cuarto numero");
        int a=stdin.nextInt();
        int b=stdin.nextInt();
        int c=stdin.nextInt();
        int d=stdin.nextInt();
        int Sum=a+b+c+d;
        System.out.println("El resultado de la suma entre "+a+"y"+b+"y"+c+"y"+d+"Es=" +Sum);
        // TODO code application logic here
    }
}
 CLASE TRIANGULO
package triangulo;
import java.util.*;
/**
 *
 * @author Sebastian Pinilla
 */
public class Triangulo {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner stdin=new Scanner(System.in);//Metodo para lectura
        System.out.println("Introduzca la altura del triangulo");
        int area1=stdin.nextInt();
        int base2=stdin.nextInt();
        int alt3=stdin.nextInt();
        int mul=base2*alt3;
        System.out.println("La multiplicacion entre "+base2+"y"+alt3+"Es= " +mul);
        // TODO code application logic here
      
    }
}

martes, 3 de abril de 2012

 JAVA
package javaapplication22;
import java.util.*;

public class JavaApplication22 {

    public static void main(String[] args) {
    Scanner stdin=new Scanner(System.in); //Mètodo para lectura
        impri("Introduzca dos números para determinar el mayor o igual");
        impri("Digite el primer Número");
        int PriNum=stdin.nextInt();
        impri("Digite el segundo Número");
        int SegNum=stdin.nextInt();
        impri("Digite el Tercer Numero");
                int TerNum=stdin.nextInt();
                int rest1,rest2;
               
                rest1=SegNum*TerNum;
                rest2=2*(SegNum+TerNum);
                       
        MayorIg MayI = new MayorIg(rest1,rest2);
        MayI.MayorIg();
    }
    static void impri(String s) {
    System.out.println(s);
    }
  }
    class MayorIg
      {
        private int Num1, Num2;
        public MayorIg(int N1,int N2){ //Constructor
         Num1=N1;
         Num2=N2;
       }
        public void MayorIg(){
                int Sum, Mul;
                if(Num1>=Num2){
                  Sum=Num1+Num2;
                  System.out.println("El mayor es: " +Num1 +" Luego la suma da =" +Sum);
                }
                else {
                  Mul=Num1*Num2;
                  System.out.println("El mayor es: " +Num2 +" Luego la Multiplicación da =" +Mul);
                }
         }
    }

DIAGRAMA DE FLUJO