Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Libro.java
- * Definición de la clase Libro
- * ============================
- *
- * @autor Luis Quesada Romero
- */
- package GestionLibreria;
- public class Libro { // Clase principal Libro
- // Atributos de objeto /////////////////////////////////////////////////////
- private String estanteria;
- private String balda;
- private String numeroLibro;
- private String codArt = estanteria + balda + numeroLibro;
- private String titulo;
- private int unidadesTotales;
- // Atributos de clase //////////////////////////////////////////////////////
- public static final int DIGITOS_ESTANTERIA = 3;
- public static final int DIGITOS_BALDA = 2;
- public static final int DIGITOS_NRI_LIBRO = 5;
- public static final int DIGITOS_DC = 2;
- // Métodos privados ////////////////////////////////////////////////////////
- /**
- * Método setter
- * Establecemos los abritutos del libro: estanteria, balda y codigoLibro
- *
- * @param CLIBC - Es el código completo del libro que introduce el
- * usuario por teclado en el programa
- */
- public void establecerLibro (String CLIBC) {
- this.estanteria = CLIBC.substring(0, 3);
- this.balda = CLIBC.substring(3, 5);
- this.numeroLibro = CLIBC.substring(5, 10);
- }
- /**
- * Método setter
- * Establecemos el título del libro
- *
- * @param titulo - Es el titulo del libro
- */
- public void establecerTitulo (String titulo) {
- this.titulo = titulo;
- }
- // MÉTODO CONSTRUCTOR //////////////////////////////////////////////////////
- /**
- * Método setter
- * Establecemos el título del libro
- *
- * @param titulo - Es el titulo del libro
- */
- public ConstructorLibro (String CLIBC, String titulo) {
- establecerLibro(CLIBC);
- establecerTitulo(titulo);
- }
- } // Fin clase principal Libro
Add Comment
Please, Sign In to add comment