miércoles, 5 de octubre de 2011

COLAS DINAMICAS EN JAVA

HOLA AMIGOS AQUI DE NUEVO CON ESTE OTRO APORTE QUE SON LAS COLAS DINAMICAS EN JAVA QUE SON PARECIDAS A LA DE PILAS SOLO QUE EN ESTA SE VA ELIMINANDO DE ABAJO HACIA ARRIVA Y COMO ES DINAMICA SE PUEDEN CREAR CIENTOS DE DATOS SIN TOPE EL UNICO TOPE ES LA CAPACIDAD DE MEMORIA DE LA COMPU..... BUENO ES IGUAL SON 3 ARCHIVOS QUE SON LOS SIGUIENTES:

EL ARCHIVO NODOLISTACOLA:

///////////////GENERA NODOS PARA LISTAS DOBLES////////////////////

class NodoListaCola{
    ////3 campos
    Object info;
    NodoListaCola Izq;/////////////asi se declara para apuntar a un dato igual a ellos
    NodoListaCola Der;
   
    /////////////primer constructor/*/////////////////
    public NodoListaCola(Object Dato){
        this.info = Dato;
        this.Izq = null;
        this.Der = null;
    }
   
    /////////////////segundo constructor///////////////
    public NodoListaCola(NodoListaCola Izq, Object Dato){
        this.Izq = Izq;
        this.info = Dato;
        this.Der = null;
    }
}

EL ARCHIVO LISTACOLA:

///////////////////////////LISTA QUE MANIPULA A LOS PUNTEROSY METODOS /////////////

class ListaCola{
    //////PUNTEROS
    public NodoListaCola Primero,Ultimo,Nuevo,Aux,Pos,Ant;
   
    //////constructor
    public ListaCola(){
        Primero = Ultimo = Nuevo = Aux = Pos = Ant = null;
    }
    ////////////////////////INSERTAR COLA//////////
    public void insertarCola(Object dato){
        if(Primero==null){//////////1 caso(lista vacia)
        Primero = new NodoListaCola(dato);
        Ultimo = Primero;
        }
        else{
            Nuevo = new NodoListaCola(Ultimo, dato);
            Ultimo.Der = Nuevo;
            Ultimo = Nuevo;
        }despliegaListaCola();
    }
   
    ///////////////ELIMINAR COLA//////////////
    public void eliminarCola(){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
        ///hacer cuatro casos
                if(Primero==Ultimo){//// 1 caso
                    Primero=Ultimo=null;
                }
                else {//2caso
                    Primero=Primero.Der;
                    Primero.Izq=null;
                }
           
        }despliegaListaCola();
    }
   
    ////////////////////DESPLEGAR LISTA DOBLE////////////////
    public  void despliegaListaCola(){
        Aux = Primero;
        System.out.println ("#########   LISTA COMPLETA   ###########");
        while (Aux != null) {
            System.out.println (Aux.info);
            Aux = Aux.Der;
        }
        System.out.println ("########################################");
    }



}

Y POR ULTIMO EL APPLISTACOLA:

import java.util.Scanner;
class AppListaCola{
    public static void main(String args[]){
        ListaCola lista = new ListaCola();
        Integer DatoB,DatoI;
        int opcion;
       
        //Inicializacion del teclado
        Scanner Teclado = new Scanner(System.in);
        do{
            System.out.println ("1) INSERTAR COLA");
            System.out.println ("2) ELIMINAR COLA");
            System.out.println ("3) DESPLEGAR LISTA");
            System.out.println ("4) SALIR");
            opcion = Teclado.nextInt();
            switch (opcion) {
                case 1: System.out.println ("Que dato quieres insertar en la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarCola(DatoI);
                        break;
                case 2: lista.eliminarCola();
                        break;
                case 3: lista.despliegaListaCola();
                        break;
                case 4: System.out.println ("BYE....");
                        break;
                                   
                default :System.out.println ("\topcion no valida intenta de nuevo\n");
            }
        }while (opcion != 4);
    }
}

BUENO AMIGOS AQUI ESTAN LOS ARCHIVOS ESPERO Y LES GUSTEN COMENTEN...


PILAS DINAMICAS EN JAVA

AQUI LES TRAEGO UN NUEVO APORTE QUE SON LAS PILAS DINAMICAS EN JAVA A DIFERENCIA DE LAS ESTATICAS ESTAS NO TIENEN UN TOPE DE LLENADO POR LO CUAL PUEDEN CREAR CIENTOS DE DATOS E IGUAL DE ELIMINARLOS... BUENO ASI LES DEBEN DE QUEDAR LOS ARCHIVOS:

EL ARCHIVO NODOLISTAPILA:

///////////////GENERA NODOS PARA LISTAS DOBLES////////////////////

class NodoListaPila{
    ////3 campos
    Object info;
    NodoListaPila Izq;/////////////asi se declara para apuntar a un dato igual a ellos
    NodoListaPila Der;
   
    /////////////primer constructor/*/////////////////
    public NodoListaPila(Object Dato){
        this.info = Dato;
        this.Izq = null;
        this.Der = null;
    }
   
    /////////////////segundo constructor///////////////
    public NodoListaPila(NodoListaPila Izq, Object Dato){
        this.Izq = Izq;
        this.info = Dato;
        this.Der = null;
    }

}


EL OTRO ARCHIVO ES EL LISTAPILA:


///////////////////////////LISTA QUE MANIPULA A LOS PUNTEROSY METODOS /////////////

class ListaPila{
    //////PUNTEROS
    public NodoListaPila Primero,Ultimo,Nuevo,Aux,Pos,Ant;
  
    //////constructor
    public ListaPila(){
        Primero = Ultimo = Nuevo = Aux = Pos = Ant = null;
    }
    //////////////////PUSH////////////////
    public void insertarPush(Object dato){
        if(Primero==null){//////////1 caso(lista vacia)
        Primero = new NodoListaPila(dato);
        Ultimo = Primero;
        }
        else{
            Nuevo = new NodoListaPila(Ultimo, dato);
            Ultimo.Der = Nuevo;
            Ultimo = Nuevo;
        }despliegaListaPila();
    }

    ///////////////POP//////////////
    public void eliminarPop(){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
        ///hacer cuatro casos
                if(Primero==Ultimo){//// 1 caso
                    Primero=Ultimo=null;
                }
                else {//2caso
                    Ultimo=Ultimo.Izq;
                    Ultimo.Der=null;
                }
          
        }despliegaListaPila();
    }
  
    ////////////////////DESPLEGAR LISTA DOBLE////////////////
    public  void despliegaListaPila(){
        Aux = Primero;
        System.out.println ("#########   LISTA COMPLETA   ###########");
        while (Aux != null) {
            System.out.println (Aux.info);
            Aux = Aux.Der;
        }
        System.out.println ("########################################");
    }
}


Y EL ULTIMO ARCHIVO APPLISTAPILA:

import java.util.Scanner;
class AppListaPila{
    public static void main(String args[]){
        ListaPila lista = new ListaPila();
        Integer DatoB,DatoI;
        int opcion;
       
        //Inicializacion del teclado
        Scanner Teclado = new Scanner(System.in);
        do{
            System.out.println ("1) PUSH");
            System.out.println ("2) POP");
            System.out.println ("3) DESPLEGAR LISTA");
            System.out.println ("4) SALIR");
            opcion = Teclado.nextInt();
            switch (opcion) {
                case 1: System.out.println ("Que dato quieres insertar en la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarPush(DatoI);
                        break;
                case 2: lista.eliminarPop();
                        break;
                case 3: lista.despliegaListaPila();
                        break;
                case 4: System.out.println ("BYE....");
                        break;
                                   
                default :System.out.println ("\topcion no valida intenta de nuevo\n");
            }
        }while (opcion != 4);
    }
}

BUENO ESO ES TODO AMIGOS ESPERO Y LES SIRVA DE MUCHO....COMENTEN..


domingo, 2 de octubre de 2011

PILAS ESTATICAS EN JAVA

AQUI LES TENGO OTRO APORTE QUE NOS ENVIO NUESTRO AMIGO JUAN QUE SE TRATA DE LAS PILAS ESTATICAS EN JAVA BUENO NO LES DIGO MAS PORQUE EL CODIGO HABLA POR SI SOLO BUENO AQUI ESTA :

import java.util.Scanner;
  
public class Cola{
  
    public static int max = 5, tope = -1;
    public static int cola[]=new int[max];

    public static void main(String args[]){
        int DatoI;
        int opcion=0;
        Scanner Teclado = new Scanner(System.in);
        do{
            System.out.println ("///////////////////////");
            System.out.println ("Elige una opcion:");
            System.out.println ("1.Insertar dato");
            System.out.println ("2.Retirar dato");
            System.out.println ("3.Desplegar Pila");
            System.out.println ("4.Salir");
            opcion=Teclado.nextInt();
          
            switch(opcion){
                case 1: System.out.println ("Que dato deseas agregar:");
                        DatoI=Teclado.nextInt();
                        Push(DatoI);
                        System.out.print("\n");
                        break;
                case 2: Pop();
                        break;
                case 3: Desplegar();
                        break;              
            }  
          
        }while(opcion!=4);
    }    //Fin de Main
      
//---------- METODO PUSH (insertar dato) ------------------------------
  
    public static void Push(int DatoI){
        if(tope < max-1){
            tope++;
            cola[tope] = DatoI;
        }              
          
        else
            System.out.println ("\n¡¡Cola llena, no se puede agregar mas elementos!!\n");
    }//Fin del Metodo Push

//---------- METODO POP (retirar dato) --------------------------------
  
    public static void Pop(){
        if(tope > -1){
            System.out.println("Elemento que sale es: "+ cola[0]+"\n");
            for (int i = 0; i<tope; i++) {
                cola[i]=cola[(i+1)];
            }
        tope--;
        }
        else
        System.out.println("\n¡¡No hay mas elementos en cola!!\n");
    }//fin del Metodo POP  
      
//----------- Desplegar ----------------------------------------------

    public static void Desplegar(){
        System.out.println ("***** Elementos en Cola *****");
        for(int i=0; i<=tope; i++){
            System.out.print("\t"+cola[i]);
          
        }
        System.out.print("\n*****************************\n");
    }


}//fin de la clase Cola

AGRADESCANLE A JUAN POR EL APORTE....


sábado, 24 de septiembre de 2011

MENU DE LISTAS LIGADAS DOBLES EN JAVA

ESTE ES LA TAREA DE PROGRAMACION JAVA DE MENU DE LISTAS LIGADAS DOBLES ESTOS SON LOS TRES ARCHIVOS QUE TIENEN QUE TENER:

EL 1° ARCHIVO SE LLAMARA NODOLISTAD ESTE ARCHIVO CONTIENE LOS CONSTRUCTORES DE LOS NODOS Y ASI QUEDATA EL PROGRAMA:

///////////////GENERA NODOS PARA LISTAS DOBLES////////////////////

class NodoListaD{
    ////3 campos
    Object info;
    NodoListaD Izq;/////////////asi se declara para apuntar a un dato igual a ellos
    NodoListaD Der;
   
    /////////////primer constructor/*/////////////////
    public NodoListaD(Object Dato){
        this.info = Dato;
        this.Izq = null;
        this.Der = null;
    }
   
    /////////////////segundo constructor///////////////
    public NodoListaD(NodoListaD Izq, Object Dato){
        this.Izq = Izq;
        this.info = Dato;
        this.Der = null;
    }
   
    //////////////////tercer constructor//////////////
    public NodoListaD(Object Dato, NodoListaD Der){
        this.Izq = null;
        this.info = Dato;
        this.Der = Der;
    }
   
    //////////////////cuarto constructor////////////////
    public  NodoListaD(NodoListaD Izq, Object Dato, NodoListaD Der){
        this.Izq = Izq;
        this.info = Dato;
        this.Der = Der;
    }
}

EL 2° ARCHIVO SE LLAMARA LISTAD ESTE ARCHIVO SON LAS FUNCIONES QUE CREARAN LOS NODOS CON LOS DIFERENTES CONSTRUCTORES:


///////////////////////////LISTA QUE MANIPULA A LOS PUNTEROSY METODOS /////////////

class ListaD{
    //////PUNTEROS
    public NodoListaD Primero,Ultimo,Nuevo,Aux,Pos,Ant;
   
    //////constructor
    public ListaD(){
        Primero = Ultimo = Nuevo = Aux = Pos = Ant = null;
    }
    ////////////////////////INSERTAR AL FRENTE//////////
    public void insertarAlFrente(Object dato){
        if(Primero==null){//////////1 caso(lista vacia)
        Primero = new NodoListaD(dato);
        Ultimo = Primero;
        }
        else{
            Nuevo = new NodoListaD(Ultimo, dato);
            Ultimo.Der = Nuevo;
            Ultimo = Nuevo;
        }despliegaLista();
    }
    ////////////////INSERTAR ATRAS//////////////
    public void insertarAtras(Object dato){
        if(Primero==null){
            Primero = new NodoListaD(dato);
            Ultimo = Primero;
        }
        else {
            Nuevo = new NodoListaD(dato,Primero);
            Primero.Izq=Nuevo;
            Primero = Nuevo;
        }despliegaLista();
    }
    /////////INSERTAR ANTES DE //////////
    public void insertarAntesDe(Object DatoB,Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{/////hay datos
            if(buscar(DatoB)== true){
                ///////EMPEZAR A REALIZAR EL METODO
                if(Aux==Primero){///caso 1
                Nuevo= new NodoListaD(DatoI,Primero);
                Primero.Izq = Nuevo;
                Primero=Nuevo;
                }
                else{//en caso de que no este al inicio de la lista
                    Nuevo = new NodoListaD(Ant,DatoI , Aux);
                    Aux.Izq = Nuevo;
                    Ant.Der=Nuevo;
                }
            }   
        }
        despliegaLista();
    }
    ////////////////INSERTAR     DESPUES DE///////////////
    public void insertarDespuesDe(Object DatoB, Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{///hay metodos
            if(buscar(DatoB)== true){
                //////EMPEZAR A REALIZAR EL METODO/////
                if(Aux==Ultimo){
                    Nuevo=new NodoListaD(Aux,DatoI);
                    Aux.Der=Nuevo;
                    Ultimo=Nuevo;
                }
                else{///en caso de que no este al inicio de la lista
                    Nuevo= new NodoListaD(Aux,DatoI,Aux.Der);
                    Aux.Der = Nuevo;
                    Pos = Aux.Der;
                    Pos.Izq =Aux.Der;
                }
               
            }
        }despliegaLista();
    }
    ///////////////METODO ELIMINAR NODO//////////////
    public void eliminarNodo(Object DatoB){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
            if(buscar(DatoB)==true){///hacer cuatro casos
                if(Primero==Ultimo){//// 1 caso
                    Primero=Ultimo=null;
                }
                else if(Aux==Primero){//2caso
                    Primero=Aux.Der;
                    Primero.Izq=Aux=null;
                }
                else if(Aux==Ultimo){//3 caso
                    Ultimo=Ant;
                    Ultimo.Der=Aux=null;
                }
                else{//4 caso
                    Ant.Der=Pos;
                    Pos.Izq=Ant;
                    Aux=null;
                }
            }
        }despliegaLista();
    }
    /////////////METODO PARA SUSTITUIR DATO///////////////
    public void modificaLista(Object DatoB,Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
            if(buscar(DatoB)==true){
                Aux.info=DatoI;
            }
        }despliegaLista();
    }
    //////////////////////////METODO BUSCAR/////////
    public boolean  buscar(Object DatoB){
        Aux = Primero;
        boolean bandera = false;
        while (Aux != null && bandera != true) {
            if(DatoB.equals(Aux.info)){// si encuentra el dato //la funcion .equals sirve para comparar el contenido de una direccion de memoria
                bandera = true;
            }
            else{//apunta al siguiente nodo
                Ant = Aux;
                Aux = Aux.Der;
                Pos = Aux.Der;
            }
        }
        if(bandera == true){
            return true;
        }
        else{
            System.out.println ("ese dato no existe");
            return false;
        }
    }
    ////////////////////DESPLEGAR LISTA DOBLE////////////////
    public  void despliegaLista(){
        Aux = Primero;
        System.out.println ("#########   LISTA COMPLETA   ###########");
        while (Aux != null) {
            System.out.println (Aux.info);
            Aux = Aux.Der;
        }
        System.out.println ("########################################");
    }
}


EL 3° ARCHIVO SE LLAMARA APPLISTAD ESTE ES EL MENU DE DONDE SE EJECUTARAN LAS FUNCIONES:



import java.util.Scanner;
class AppListaD{
    public static void main(String args[]){
        ListaD lista = new ListaD();
        Integer DatoB,DatoI;
        int opcion;
       
        //Inicializacion del teclado
        Scanner Teclado = new Scanner(System.in);
        do{
            System.out.println ("1) Insertar al frente");
            System.out.println ("2) Insertar al Atras");
            System.out.println ("3) Insertar Antes de");
            System.out.println ("4) Insertar Despues de");
            System.out.println ("5) Eliminar Dato");
            System.out.println ("6) Modificar Dato");
            System.out.println ("7) DesplegarLista");
            System.out.println ("8) Salir");
            opcion = Teclado.nextInt();
            switch (opcion) {
                case 1: System.out.println ("Que dato quieres insertar al frente de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarAlFrente(DatoI);
                        break;
                case 2: System.out.println ("Que dato quieres insertar Atras de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarAtras(DatoI);
                        break;
                case 3: System.out.println ("Que dato quieres insertar Antes de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        System.out.println ("Atras de que dato quieres insertar el :"+DatoI);
                        DatoB = new Integer(Teclado.nextInt());
                        lista.insertarAntesDe(DatoB,DatoI);
                        break;
                case 4: System.out.println ("Que dato quieres insertar Despues de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        System.out.println ("Despues de que dato quieres insertar el :"+DatoI);
                        DatoB = new Integer(Teclado.nextInt());
                        lista.insertarDespuesDe(DatoB,DatoI);
                        break;
                case 5: System.out.println ("Que dato quieres ELiminar de la Lista: ");
                        DatoB = new Integer(Teclado.nextInt());
                        lista.eliminarNodo(DatoB);
                        break;
                   case 6: System.out.println ("Que dato quieres buscar para sustituir: ");
                           DatoB = new Integer(Teclado.nextInt());
                           System.out.println ("Que dato quieres poner en el numero "+DatoB+":");
                           DatoI = new Integer(Teclado.nextInt());
                           lista.modificaLista(DatoB,DatoI);
                        break;
                   case 7: lista.despliegaLista();
                        break;
                case 8: System.out.println ("\tbye...\n");
                        break;                               
                default :System.out.println ("\topcion no valida intenta de nuevo\n");
            }
        }while (opcion != 8);
    }
}


BUENO AMIGOS COMENTEN PARA DECIR QUE LES PARESE ACEPTO NEGATIVAS, INSULTOS Y DEMAS AUNQUE LOS BORRARE PERO USTEDES COMENTEN HAHAHAHA AUNQUE SEA PARA AGRADECER......


miércoles, 21 de septiembre de 2011

RECONOCIMIENTO DE PROGRAMACION

HOLA DE NUEVO GENTE OTRA VEZ AQUI SOLO PARA COMPARTIR UNO DE MIS LOGROS QUE NO FUE SOLO MIO SINO DEL EQUIPO QUE PARTICIPAMOS EN EL SEGUNDO ENCUENTRO DE ESTUDIANTES REALIZADO POR EL CENTRO UNIVERSITARIO DE LOS VALLES MI EQUIPO ESTABA CONFORMADO POR RAMON BUENO HERNANDEZ, JUAN MANUEL HERNANDEZ QUINTERO Y SU SERVIDOR JOSE SALVADOR MUÑIZ ALCANTAR ESTE MISMO EL CAPITAN DEL EQUIPO LLAMADO "LOS BURROS SIN MECATE" QUE PARTICIPAMOS EN EL CONCURSO DE PROGRAMACION BASICA QUE CONSTABA DE REALIZAR LA MAYOR CANTIDAD DE PROGRAMAS INDICADOS POR LOS JUECES QUIENES CALIFICABAN EL TIEMPO Y EL PROGRAMA EN SU ESTRUCTURA Y SU FUNCIONAMIENTO DEL CUAL DESPUES DE TERMINAR LA COMPETENCIA LA RESOLUCION DE LOS JUECES FUE OTORGARNOS EL PRIMER LUGAR DEL CONCURSO A NUESTRO EQUIPO Y HASTA HACE UNAS SEMANAS NOS ENTREGRARON ESTOS RECONOSIMIENTOS Y ESE MISMO DIA DEL CONCURSO UNOS PREMIOS QUE LA VERDAD VALIERON LA PENA BUENO NO LES PLATICO MAS QUE AQUI ESTAN LOS RECONOCIMIENTOS COMENTEN POR FAVOR....













MENU DE LISTAS LIGADAS SIMPLES EN JAVA

BUENO AMIGOS DE LA CARRERA DE MECATRONICA Y A TODA LA GENTE QUE SE DIO LA OPORTUNIDAD DE LEER ESTO AQUI LES SUBO LA TAREA DE ESTA SEMANA DE PROGRAMACION QUE SON LAS LISTAS LIGADAS TERMINADOS TODOS LOS CASOS Y JALANDO A TODA MADRE BUENO JENTE DISFRUTENLO.......... Y POR FAVOR SI LO VAN A COPIAR Y PEGAR POR FAVOR DE PERDIDA COMENTEN Y AGRADESCAN QUE ME MATE HACIENDO ESTO HAHAHAHAHA NO ES CIERTO NO POR ALGO SOMOS EL #1 EN EL CONCURSO DE PROGRAMACION BASICA.

EL PRIMER ARCHIVO SE DEBE DE LLAMAR NODOLISTA Y ASI QUEDARA:

///clase (registro) que sirve para generar nodos de dos tipos de formas (2 constructores)

public class NodoLista {
    // 2 campos
    Object Info;
    NodoLista Liga;
   
    //PRIMER CONSTRUCTOR
    public NodoLista(Object dato){
        Info = dato;
        Liga = null;
    }
   
    //SEGUNDO CONSTRUCTOR
    public NodoLista(Object dato, NodoLista liga){
        Info = dato;
        this.Liga = liga;  /////el this solo es para decir que la primera "liga"
    }                          ////es global
}


ESTE ES EL ARCHIVO LLAMADO  LISTA , ES DONDE SE REALIZAN LAS FUNCIONES PARA EJECUTAR LOS CONSTRUCTORES, ASI DEBE DE QUEDAR:


//// clase que manipula a los punteros para manipular los nodos en la memoria

public class Lista{
    // declarar los punteros!!!
    NodoLista Primero, ultimo, aux, nuevo, ant, post;
   
    public Lista(){
        Primero = ultimo = aux = nuevo = ant = post = null;
    }
   
    public void insertarAlFrente(Object dato){
        if(Primero==null){// si la lista esta vacia
            Primero = new NodoLista(dato);
            ultimo=Primero;
        }
        else{////ya hay mas nodos en la lista
            nuevo = new NodoLista(dato);
            ultimo.Liga = nuevo;
            ultimo = nuevo;
        }despliegaLista();         
    }
   
    public void insertarAtras(Object dato){
        if(Primero==null){// si la lista esta vacia
            Primero = new NodoLista(dato);
            ultimo=Primero;
        }
        else{
            nuevo = new NodoLista(dato,Primero);
            Primero = nuevo;
        }despliegaLista();
    }   
   
    public void despliegaLista(){
        aux = Primero;
        System.out.println ("##########LISTA COMPLETA#########");
        while (aux != null) {
            System.out.println (aux.Info);
            aux = aux.Liga;
        }
        System.out.println ("##########LISTA COMPLETA#########");
    }
    /////////INSERTAR ANTES DE //////////
    public void insertarAntesDe(Object DatoB,Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{/////hay datos
            if(buscar(DatoB)== true){
                ///////EMPEZAR A REALIZAR EL METODO
                if(aux==Primero){///caso 1
                nuevo= new NodoLista(DatoI,Primero);
                Primero = nuevo;
                }
                else{//en caso de que no este al inicio de la lista
                    nuevo = new NodoLista(DatoI , aux);
                    ant.Liga = nuevo;
                }
            }   
        }
        despliegaLista();
    }
    //////////////INSERTAR DESPUES DE//////////////////
    public void insertarDespuesDe(Object DatoB, Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{///hay metodos
            if(buscar(DatoB)== true){
                //////EMPEZAR A REALIZAR EL METODO/////
                if(aux==Primero){
                    nuevo=new NodoLista(DatoI);
                    Primero.Liga=nuevo;
                }
                else{///en caso de que no este al inicio de la lista
                    nuevo= new NodoLista(DatoI, aux.Liga);
                    aux.Liga=nuevo;
                }
               
            }
        }despliegaLista();
    }
   
    ///////////////METODO ELIMINAR NODO//////////////
    public void eliminarNodo(Object DatoB){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
            if(buscar(DatoB)==true){///hacer cuatro casos
                if(Primero==ultimo){//// 1 caso
                    Primero=ultimo=null;
                }
                else if(aux==Primero){
                    Primero=aux.Liga;
                    aux=null;
                }
                else if(aux==ultimo){
                    ultimo=ant;
                    ultimo.Liga=null;
                    aux=null;
                }
                else{
                    ant.Liga=aux.Liga;
                    aux=null;
                }
            }
        }despliegaLista();
    }
   
    /////////////METODO PARA SUSTITUIR DATO///////////////
    public void modificaLista(Object DatoB,Object DatoI){
        if(Primero==null){
            System.out.println ("lista vacia");
        }
        else{
            if(buscar(DatoB)==true){
                aux.Info=DatoI;
            }
        }despliegaLista();
    }
    //////////////////////////METODO BUSCAR/////////
    public boolean  buscar(Object DatoB){
        aux = Primero;
        boolean bandera = false;
        while (aux != null && bandera != true) {
            if(DatoB.equals(aux.Info)){// si encuentra el dato
                bandera = true;
            }
            else{//apunta al siguiente nodo
                ant = aux;
                aux = aux.Liga;
                post = aux.Liga;
            }
        }
        if(bandera == true){
            return true;
        }
        else{
            System.out.println ("ese dato no existe");
            return false;
        }
    }
   
}


ESO FUE EL ARCHIVO LISTA Y ESTE ES EL ARCHIVO APPLISTA , ES DONDE SE LLAMARAN A LAS FUNCIONES ASI DEBE DE QUEDAR:


import java.util.Scanner;
class AppLista{
    public static void main(String args[]){
        Lista lista = new Lista();
        Integer DatoB,DatoI;
        int opcion;
      
        //Inicializacion del teclado
        Scanner Teclado = new Scanner(System.in);
        do{
            System.out.println ("1) Insertar al frente");
            System.out.println ("2) Insertar al Atras");
            System.out.println ("3) Insertar Antes de");
            System.out.println ("4) Insertar Despues de");
            System.out.println ("5) Eliminar Dato");
            System.out.println ("6) Modificar Dato");
            System.out.println ("7) DesplegarLista");
            System.out.println ("8) Salir");
            opcion = Teclado.nextInt();
            switch (opcion) {
                case 1: System.out.println ("Que dato quieres insertar al frente de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarAlFrente(DatoI);
                        break;
                case 2: System.out.println ("Que dato quieres insertar Atras de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        lista.insertarAtras(DatoI);
                        break;
                case 3: System.out.println ("Que dato quieres insertar Antes de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        System.out.println ("Atras de que dato quieres insertar el :"+DatoI);
                        DatoB = new Integer(Teclado.nextInt());
                        lista.insertarAntesDe(DatoB,DatoI);
                        break;
                case 4: System.out.println ("Que dato quieres insertar Despues de la Lista:  ");
                        DatoI = new Integer(Teclado.nextInt());
                        System.out.println ("Despues de que dato quieres insertar el :"+DatoI);
                        DatoB = new Integer(Teclado.nextInt());
                        lista.insertarDespuesDe(DatoB,DatoI);
                        break;
                case 5: System.out.println ("Que dato quieres ELiminar de la Lista: ");
                        DatoB = new Integer(Teclado.nextInt());
                        lista.eliminarNodo(DatoB);
                        break;
                   case 6: System.out.println ("Que dato quieres buscar para sustituir: ");
                           DatoB = new Integer(Teclado.nextInt());
                           System.out.println ("Que dato quieres poner en el numero "+DatoB+":");
                           DatoI = new Integer(Teclado.nextInt());
                           lista.modificaLista(DatoB,DatoI);
                        break;
                   case 7: lista.despliegaLista();
                        break;
                case 8: System.out.println ("\tbye...\n");
                        break;                               
                default :System.out.println ("\topcion no valida intenta de nuevo\n");
            }
        }while (opcion != 8);
    }
}

ESO ES TODO COMPAÑEROS ASI QUE NO SEAN CABRAS Y COMENTEN DE PERDIDA PARA AGRADESER CABRONES!!!...




jueves, 21 de julio de 2011

LAS PERSONAS QUE ARRUINAN TU FOTO

este video se los muestro porque me hizo reir muchisimo jajajaja bueno bueno mejor aqui se los dejo para que lo disfruten
 
ya ven por eso cuando se tomen una foto simpre revicen que no alla algun pen!"#$% atras. jajaja !comenten!
 

jueves, 7 de julio de 2011

CODIGO PARA ORDENAR LOS DATOS DE UN VECTOR CON EL METODO DE LA BURBUJA

BUENO AMIGOS AKI DE NUEVO CON UN NUEVO APORTE QUE NOS HIZO FAVOR DE ENVIAR NUESTRO GRAN AMIGO JUAN MANUEL "JANMAN", ES UN CODIGO EN C++ PARA ORDENAR DE MENOR A MAYOR LOS NUMEROS INTRODUCIDOS EN UN VECTOR CON EL METODO DE LA BURBUJA Y LOS IMPRIME EN PANTALLA, BUENO AQUI SE LOS DEJO ESPERO Y LES SIRVA DE MUCHO AAAAA Y POR FAVOR TENGAN LA AMABILIDAD DE COMENTAR PARA AGRADECERLE A JUAN MANUEL "JANMAN".

#include <stdio.h>
#include <conio.h>
main()
{
int vector[5];
int i, m, n;
int vuelta=0;
for(i=0; i<5;i++)
     {printf("\nIntroduce valor %d   \n", i+1);
      scanf("%d", &vector[i]);
      }
do{
for(i=0; i<5;i++)
{
 n=vector[i];
 m=vector[i+1];
 if (vector[i]>vector[i+1])
   {vector[i+1]=n;
    vector[i]=m;
   }
}
vuelta++;
}while(vuelta!=5);
    printf("\nvalores:");
for(i=0; i<5;i++)
     printf("\n%d\n", vector[i]);
 
        
getch();     
}

jueves, 23 de junio de 2011

SECUENCIADOR DE LUCES

aqui les traego este nuevo aporte de las luces secuenciales es muy sencillo 
 este circuito es muy sencillo aqui les dejo una imagen de como se debe de ver en el proto  hay tambien viene de cuanto debe de ser cada cosa la resistencia de 100k es un potenciometro para que puedan variar el 555 bueno esto es todo comenten y ustedes tambien hagan sus aportes aqui.
 

jueves, 2 de junio de 2011

CONTADOR JHONSON DE 4 BITS

AQUI LES TRAEGO UN NUEVO APORTE ES UN CONTADOR JHONSON DE 4 BITS ESTE DIAGRAMA ES MUY SENCILLO ES PARECIDO AL CONTADOR DE 0 A 9 SOLO QUE EL PULSO ESTA CONECTADO A LAS ENTRADAS DE RELOJ DEL FLIP FLOP Y LAS SALIDAS DEL ULTIMO FLIP FLOP ESTAN CONECTADAS CON LAS ENTRADAS DE LOS PRIMEROS AQUI SE LOS DEJO:



 PARA ESTE CIRCUITO SE NECESITA:
1- 555
2 FLIP FLOP JK 74LS76
4 LED
1 RESISTENCIA  4.7K
1 RESISTENCIA 1K
1 CAPACITOR DE 100UF
1 CAPACITOR DE 100PF

BUENO ESO ES TODO LO NECESARIO ESPERO Y LES AGRADE RECUERDEN COMENTAR

CONTADOR DE 0-9 CON FLIPFLOP JK

aqui les traego un nuevo aporte a la comunidad es un contador de    0 a 9 con 2 flip flop jk y una compuerta nand en este caso la compuerta nand la utilizamos para que funcione de reset al momento de que llegue al numero nueve el contador la compuerta nand se activara y la salida de esta misma estara conectada a los reset de los flip flop de este modo se reiniciaran y volvera a empezar la cuenta.
 este es el diagrama  conta de:
1- 555 
2 flip flop jk 74ls76 
1 nand 74ls00 
1 decodificador 74ls47 
1 display de anodo
1 resistensia de 4.7k
1 resistensia de 1k
1 capacitor de 100uf
1 capacitor de 100pf
y si le quieren poner resistensias al display agregan 
7 resistensias de 300 ohms

espero  y les sea de utilidad comenten.

miércoles, 1 de junio de 2011

PROGRAMACION PIC EN C

hola amigos aqui de nuevo con una nueva aportacion para el blog esta vez les traigo una presentacion de power point para que la disfruten esta presentacion es para que aprendan a programar pic en c con un programa muy bueno que se llama mikroc que les permite programarlos de una forma sencilla y rapida solo agregan la librerias que trae el programa, claro que solo agregaran las librerias que van a utilizar bueno... que mas les puedo decir espero y sea de su agrado comenten y suscribanse aqui les dejo el link para que lo descarguen cualquier anomalia con el link me lo hacen saber para corregirlo.

descarga el tutorial de mikro c haciendo clic aqui

comenten y suscribanse.

MENU DE FUNCIONES TRIGONOMETRICAS

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <conio.h>

float y, n;
int s, i=0;
double seno(float x)
{
   y=sin(x);
   return (y);
}
double coseno(float x)
{
   y=cos(x);
   return (y);
}
double tangente(float x)
{
   y=tan(x);
   return (y);
}
void menu()
{
     printf("\n\n\t*Este programa calcula funciones trigonometricas*");
     printf("\n1. seno");
     printf("\n2. coseno");
     printf("\n3. tangente");
     printf("\n4. salir");
     printf("\n\n Selecciona una de estas opciones:");
     scanf("%d",&s);
    
}

int main()
{
    menu();
    for(i=s;i!=4;)
    {
         system("cls");
         menu();
        
         if(s==4)
         {
             exit(0);   
         }   
         if(s>4)
         {
                printf("\n\n no existe la opcion %d, intenta de nuevo.",s);
         }
        
   
    switch(s)
    {
    case 1:
         printf("\n\nEscribe el numero:");
         scanf("%f", &n);
         printf("\n\n El seno del numero %f es: %.3f",n,seno(n));
    break;
    case 2:
         printf("\n\nEscribe el numero:");
         scanf("%f", &n);
         printf("\n\n El coseno del numero %f es: %.3f",n,coseno(n));
    break;
    case 3:
         printf("\n\nEscribe el numero:");
         scanf("%f", &n);
         printf("\n\n La tangente del numero %f es: %.3f",n,tangente(n));    
    break;
    }  getch();
    }       
    getch();
    return 1;
}








"ESPERO Y LES SEA DE UTILIDAD" SUSCRIBANSE Y DEJEN COMENTARIOS PARA MEJORAR EL BLOG, PIDAN LO QUE OCUPEN Y TRATARE DE CONSEGUIRLO SOBRES DE RATO.

codigo de menu de divisas en c++

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

float r;
int opcion;
float europ( float e)
{
      r=16.5892517*e;
      return(r);
}

float peseu( float p)
{
      r=p*0.0602799944;
      return(r);
}

float pesdol( float p)
{
      r=p*0.086116;
      return(r);
}

float dolpes(float d)
{
      r=d*11.612244;
      return(r);
}

void menu()
{
    do
{
    system("cls");
    printf("\n\n\t Convertidor de divisas\n");
    printf("\n1. pesos a dolares.\n");
    printf("\n2. pesos a euros.\n");
    printf("\n3. dolares a pesos.\n");
    printf("\n4. euros a pesos.\n");
    printf("\n5. salir.\n");
    printf("\n\t selecciona una de las opciones\n");
    scanf("%d",&opcion );
    if (opcion == 5)
    exit(0);
    if (opcion >5)
    printf("\n\n\t opcion no valida inteta de nuevo");
}   while (opcion!=1 && opcion!=2 && opcion!=3 && opcion!=4);
}
int main()
{
   
    while(opcion!=5)
    {
    menu();

     float cant;
     switch(opcion)
     {
     case 1:
     printf("introduce tu cantidad de dinero:");
     scanf("%f",&cant);
     printf("\n\n\t $%.2f pesos son lo mismo que $%.2f dolares\n\n",cant,pesdol(cant)); 
     break;
     case 2:
     printf("introduce tu cantidad de dinero:");
     scanf("%f",&cant);
     printf("\n\n\t $%.2f pesos son lo mismo que $%.2f euros\n\n",cant,peseu(cant));
     break;
     case 3:
     printf("introduce tu cantidad de dinero:");
     scanf("%f",&cant);
     printf("\n\n\t $%.2f dolares son lo mismo que $%.2f pesos\n\n",cant,dolpes(cant));
     break;
     case 4:
     printf("introduce tu cantidad de dinero:");
     scanf("%f",&cant);
     printf("\n\n\t $%.2f euros son lo mismo que $%.2f pesos\n\n",cant,europ(cant)); 
     break;
     }
     system("pause");
     }   
    getch();
    return 1;
}