-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibro.java
More file actions
41 lines (35 loc) · 1.06 KB
/
Libro.java
File metadata and controls
41 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Libro.java
public class Libro extends RecursoBibliografico {
private String autor;
private String isbn;
private boolean prestado;
public Libro(String id, String titulo, String autor, String isbn) {
super(id, titulo);
this.autor = autor;
this.isbn = isbn;
this.prestado = false; // Al crear un libro, está disponible por defecto
}
public String getAutor() {
return autor;
}
public String getIsbn() {
return isbn;
}
public void setPrestado(boolean prestado) {
this.prestado = prestado;
}
@Override
public boolean estaDisponible() {
return !prestado;
}
@Override
public void mostrarDetalle() {
System.out.println("=== LIBRO ===");
System.out.println("ID: " + id);
System.out.println("Título: " + titulo);
System.out.println("Autor: " + autor);
System.out.println("ISBN: " + isbn);
System.out.println("Estado: " + (prestado ? "Prestado" : "Disponible"));
System.out.println("============");
}
}