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) { // registrar un nuevo libro.
- for (Estante e : estantesPP) {
- if (e.categoria == (cate)) {
- if (e.cantidadEspacioLibre() >= ancho) {
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- e.agregarLibro(aux);
- return;
- }
- }
- }
- for (Estante e : estantesPP) {
- if (e.categoria == null ) {
- e.categoria = cate;
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- e.agregarLibro(aux);
- return;
- }
- }
- Libro aux = new Libro(isbn, cate, titulo, ancho);
- Estante estanteNuevo = new Estante(estantesPP.size() + 1, aux.categoria, anchoEstantes);
- estanteNuevo.agregarLibro(aux);
- estantesPP.add(estanteNuevo);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement