Procesamiento de datos
-
Upload
jbersosa -
Category
Automotive
-
view
291 -
download
2
Transcript of Procesamiento de datos
![Page 1: Procesamiento de datos](https://reader036.fdocuments.co/reader036/viewer/2022071814/55a4fc831a28abf34a8b457a/html5/thumbnails/1.jpg)
PROCESAMIENTO DE DATOS
PILAS
Clase Principal
package pilas;
import java.util.Scanner;
public class Pilas {
public static void main(String[] args) {
Scanner teclado=new Scanner(System.in);
Nodo tope=null, aux;
char resp;
System.out.println("continuar s/n");
resp=teclado.next().charAt(0);
while (resp=='s'){
aux=new Nodo();
if (tope==null)
aux.antes=null;
else
aux.antes=tope;
teclado.nextLine();
System.out.println("nombre");
aux.nombre=teclado.nextLine();
![Page 2: Procesamiento de datos](https://reader036.fdocuments.co/reader036/viewer/2022071814/55a4fc831a28abf34a8b457a/html5/thumbnails/2.jpg)
System.out.println("posicion");
aux.posicion=teclado.nextInt();
tope=aux;
System.out.println("continuar s/n");
resp=teclado.next().charAt(0);
}
while (tope!=null) {
System.out.println("nombre " + tope.nombre + " esta en la posicion
" + tope.posicion);
tope=tope.antes;}
}
}
Clase Nodo
package pilas;
public class Nodo {
protected String nombre;
protected int posicion;
protected Nodo antes; }