Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public void ingresarLibro(String isbn, String cate, String titulo, float ancho) { // registrar un nuevo libro.
  2. for (Estante e : estantesPP) {
  3. if (e.categoria == (cate)) {
  4.  
  5. if (e.cantidadEspacioLibre() >= ancho) {
  6. Libro aux = new Libro(isbn, cate, titulo, ancho);
  7. e.agregarLibro(aux);
  8.  
  9. return;
  10. }
  11. }
  12. }
  13. for (Estante e : estantesPP) {
  14.  
  15. if (e.categoria == null ) {
  16.  
  17. e.categoria = cate;
  18. Libro aux = new Libro(isbn, cate, titulo, ancho);
  19. e.agregarLibro(aux);
  20. return;
  21. }
  22. }
  23.  
  24. Libro aux = new Libro(isbn, cate, titulo, ancho);
  25. Estante estanteNuevo = new Estante(estantesPP.size() + 1, aux.categoria, anchoEstantes);
  26. estanteNuevo.agregarLibro(aux);
  27. estantesPP.add(estanteNuevo);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement