Explora Libros electrónicos
Categorías
Explora Audiolibros
Categorías
Explora Revistas
Categorías
Explora Documentos
Categorías
DESARROLLO DE SOFTWARE.
CUARTO NIVEL
PROGRAMACIÓN ORIENTADA A
OBJETOS II
PROFESOR:
MSC. ISMELIS CASTELLANOS LÓPEZ
ALUMNO:
ALVARO CALDERÓN ECHEVERRÍA
2021
PROGRAMACIÓN ORIENTADA A OBJETOS II– UNIDAD III
CÓDIGO FUENTE:
CLASE IMPRESIONES:
package tarea.pkg3.asce;
public class IMPRESIONES implements Comparable<IMPRESIONES>
{
private String Idpc;
private String nombre_documento;
private int prioridad;
private int paginas;
private int copias;
@Override
public int compareTo(IMPRESIONES t)
{
if (prioridad<t.getPrioridad())
{
return -1;
} else if(prioridad>t.getPrioridad())
{
return 1;
}else
{
return 0;
}
}
public IMPRESIONES(String Idpc, String nombre_documento, int prioridad, int paginas, int
copias)
{
this.Idpc = Idpc;
this.nombre_documento = nombre_documento;
this.prioridad = prioridad;
this.paginas = paginas;
this.copias = copias;
}
{
return nombre_documento;
}
@Override
public String toString() {
String tecla;
Scanner input = new Scanner(System.in);
Scanner teclado = new Scanner(System.in);
COLADEIMPRESION<IMPRESIONES> cola = new COLADEIMPRESION<>();
do
{
do
{
System.out.println("SIMULADOR DE COLA DE IMPRESION-ASCE");
System.out.println("1. AÑADIR UNA IMPRESION");
System.out.println("2. IMPRIMIR EL PRIMER ARCHIVO EN COLA");
System.out.println("3. CANTIDAD ELEMENTOS EN COLA");
System.out.println("4. MOSTRAR COLA DE IMPRESION");
System.out.println("5. IMPRIMIR TODOS LOS DOCUMENTOS EN COLA");
System.out.println("6. SALIR");
System.out.print("ELIJA UNA OPCION(1-6)==> ");
opc = input.nextInt();
}while(opc < 1 || opc > 6);
switch(opc)
{
case 1:
String idpc;
String nomdoc;
int pri;
int pag;
int copia;
System.out.print("INGRESE ID. DE LA COMPUTADORA==> ");
input.nextLine();
idpc = input.nextLine();
try
{
tecla = teclado.nextLine();
}
catch(Exception e)
{}
break;
case 2:
cola.atenderimpresion();
System.out.println(" ");
System.out.println("PRESIONE UNA TECLA PARA CONTINUAR...");
try
{
tecla = teclado.nextLine();
}
catch(Exception e)
{}
break;
case 3:
System.out.println("HAY " + cola.impresionesporatender() + " ARCHIVOS EN
COLA DE ESPERA");
System.out.println(" ");
System.out.println("PRESIONE UNA TECLA PARA CONTINUAR...");
try
{
tecla = teclado.nextLine();
}
catch(Exception e)
{}
break;
case 4:
cola.mostrarimpresionesencola();
System.out.println(" ");
System.out.println("PRESIONE UNA TECLA PARA CONTINUAR...");
try
{
tecla = teclado.nextLine();
}
catch(Exception e)
{}
break;
case 5:
cola.atendertodaslasimpresiones();
System.out.println(" ");
System.out.println("PRESIONE UNA TECLA PARA CONTINUAR...");
try
{
tecla = teclado.nextLine();
}
catch(Exception e)
{}
break;
case 6:
System.exit(0);
}
}while (true);
}
}
OPCIÓN 1:
OPCIÓN 2:
OPCIÓN 3:
OPCIÓN 4:
OPCIÓN 5: