lunes, 6 de septiembre de 2010

ALGUNOS DE LOS PROGRAMAS KE A DEJADO EL PROFE...

EL  PRIMERO  ES EL  DE  PILAS...


class principal


{

public static void main(String a[])

{

pilas p1=new pilas();

p1.inser(7);

p1.inser(10);

p1.inser(15);

p1.vis();

p1.bus(10);

p1.elimina(7);

p1.modificar(15,11);

}

}class pilas{


nodo tope,tem1;

public pilas()

{

tope=null;

}

public void inser(int a1)

{

nodo n=new nodo(a1);

n.ptr=tope;

tope=n;

}

public void vis()

{

tem1=tope;

while(tem1!=null)

{

System.out.println("D"+tem1.inf);

tem1=tem1.ptr;

}

}

public void bus(int s)

{

int b=0;

tem1=tope;

while(tem1!=null)

{

if(tem1.inf==s)

{

System.out.println("SI ESTA");

b=1;

}

tem1=tem1.ptr;

}

if(b==0)

System.out.println("NO TA");

}

public void elimina (){

if (tope!=null){

tope=tope.ptr;

}

else {

System.out.println("ya no hay");

}

}

public void modificar(int a,int b){

b=0;

tem1=tope;

while(tem1!=null){

if(tem1.inf==a){

tem1.inf=b;

b=1;

}tem1=tem1.ptr;

}

if(b==0){

System.out.println("No se Encontro");

}

}

}class nodo{


int inf, inf1;

String inf2;double inf3;

nodo ptr;

public nodo (int a)

{ inf=a;ptr=null;System.out.println("se creo nodo");

}

public nodo (int a1,double a2)

{inf1=a1;inf3=a2;inf2="ijole";ptr=null;

System.out.println("creo nodo");

}

}
 
EL OTRO KE ESTAMOS HACIENDO  DEL DIRECTORIO  SOLO  KE ME FALTA  PEDIR DATO DESDE  PANTALLA  PERO   PARA  MAÑANA  YA  LO  SUBIRE.
 
(conocido  por el  profe como pilas6)
class principal6


{

public static void main(String a[]){

{

pilas6 p6=new pilas6();

p6.inser("AngelJuanVictor","Calle666","74444666",320666);

p6.vis();

}

}

}
//pilas




class pilas6

{ nodo6 tope,tem1;



public pilas6 ()

{

tope=null;

}

public void inser(String a1,String b1,String c1,int c2)

{

nodo6 n=new nodo6(a1,b1,c1,c2);

n.ptr=tope; tope=n;

}

public void vis()

{ tem1=tope;

while(tem1!=null)

{io.ln("dato:"+tem1.nombre);

io.ln("dato:"+tem1.dir);

io.ln("dato:"+tem1.tel);

io.ln("dato:"+tem1.control);

tem1=tem1.ptr;

}

}

}
 
class nodo6


{int control;

String nombre,tel,dir;

nodo6 ptr;



public nodo6(String a1,String b1,String c1,int c2)

{nombre=a1; dir=b1; tel=c1; ptr=null; control=c2;

System.out.println("W E L L C O M E Now Loading...");

}

}
 
 
 
alguna duda  ps  me preguntan ami  correo...  lobo-blanko@hotmail.com ( el de  gmail no me  gusta  jajaja )