Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public void ingresarLibro(String isbn, String cate, String titulo, float ancho) {
  2.  
  3. for (Estante e : estantesPP) {
  4. if (e.categoria == null && e.cantidadEspacio() >= ancho) {
  5.  
  6.  
  7. e.categoria = cate;
  8. Libro aux = new Libro(isbn, cate, titulo, ancho);
  9. e.agregarLibro(aux);
  10. agregarLibroYCantidad(aux);
  11. return;
  12. } else {
  13. if (e.categoria.equals(cate)) {
  14. if (e.cantidadEspacio() >= ancho) {
  15. Libro aux = new Libro(isbn, cate, titulo, ancho);
  16. e.agregarLibro(aux);
  17. agregarLibroYCantidad(aux);
  18. return;
  19. }
  20. } else {
  21. if (e.categoria != cate && e.cantidadEspacio() == e.ancho) {
  22. e.categoria = cate;
  23. Libro aux = new Libro(isbn, cate, titulo, ancho);
  24. e.agregarLibro(aux);
  25. agregarLibroYCantidad(aux);
  26. return;
  27. }
  28. }
  29. }
  30. }
  31.  
  32. Libro aux = new Libro(isbn, cate, titulo, ancho);
  33. Estante estanteNuevo = new Estante(estantesPP.size() + 1, aux.categoria, 100);
  34. estanteNuevo.agregarLibro(aux);
  35. estantesPP.add(estanteNuevo);
  36. agregarLibroYCantidad(aux);
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement