You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
578 B
19 lines
578 B
package patronChainOfResponsibility;
|
|
|
|
public class PresidentePCompra extends PoderDeCompra{
|
|
private final int PERMISIBLE = 60 * base;
|
|
@Override
|
|
public void procesarPeticion(PeticionDeCompra peticion) {
|
|
if( peticion.getImporte() < PERMISIBLE) {
|
|
System.out.println("El presidente puede aprobar la cantidad de "+ peticion.getImporte()+" euros.");
|
|
}else{
|
|
if(sucesor!= null) {
|
|
sucesor.procesarPeticion(peticion);
|
|
}else {
|
|
System.out.println("La cantidad de " + peticion.getImporte() + " euros debe ser aprobada por un equipo de dirección");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|