Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ingresarLibro(String isbn, String cate, String titulo, float ancho) {
- for (Estante e : estantesPP) {
- if (e.categoria == null && e.cantidadEspacio() >= ancho) {
- e.categoria = cate;
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- e.agregarLibro(aux);
- agregarLibroYCantidad(aux);
- return;
- } else {
- if (e.categoria.equals(cate)) {
- if (e.cantidadEspacio() >= ancho) {
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- e.agregarLibro(aux);
- agregarLibroYCantidad(aux);
- return;
- }
- } else {
- if (e.categoria != cate && e.cantidadEspacio() == e.ancho) {
- e.categoria = cate;
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- e.agregarLibro(aux);
- agregarLibroYCantidad(aux);
- return;
- }
- }
- }
- }
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- Estante estanteNuevo = new Estante(estantesPP.size() + 1, aux.categoria, 100);
- estanteNuevo.agregarLibro(aux);
- estantesPP.add(estanteNuevo);
- agregarLibroYCantidad(aux);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement