Guest User

Untitled

a guest
Jan 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. /**
  2. * Libro.java
  3. * Definición de la clase Libro
  4. * ============================
  5. *
  6. * @autor Luis Quesada Romero
  7. */
  8.  
  9. package GestionLibreria;
  10.  
  11. public class Libro { // Clase principal Libro
  12.  
  13. // Atributos de objeto /////////////////////////////////////////////////////
  14.  
  15. private String estanteria;
  16. private String balda;
  17. private String numeroLibro;
  18. private String codArt = estanteria + balda + numeroLibro;
  19. private String titulo;
  20. private int unidadesTotales;
  21.  
  22. // Atributos de clase //////////////////////////////////////////////////////
  23.  
  24. public static final int DIGITOS_ESTANTERIA = 3;
  25. public static final int DIGITOS_BALDA = 2;
  26. public static final int DIGITOS_NRI_LIBRO = 5;
  27. public static final int DIGITOS_DC = 2;
  28.  
  29. // Métodos privados ////////////////////////////////////////////////////////
  30.  
  31. /**
  32. * Método setter
  33. * Establecemos los abritutos del libro: estanteria, balda y codigoLibro
  34. *
  35. * @param CLIBC - Es el código completo del libro que introduce el
  36. * usuario por teclado en el programa
  37. */
  38.  
  39. public void establecerLibro (String CLIBC) {
  40. this.estanteria = CLIBC.substring(0, 3);
  41. this.balda = CLIBC.substring(3, 5);
  42. this.numeroLibro = CLIBC.substring(5, 10);
  43. }
  44.  
  45. /**
  46. * Método setter
  47. * Establecemos el título del libro
  48. *
  49. * @param titulo - Es el titulo del libro
  50. */
  51.  
  52. public void establecerTitulo (String titulo) {
  53. this.titulo = titulo;
  54. }
  55.  
  56. // MÉTODO CONSTRUCTOR //////////////////////////////////////////////////////
  57.  
  58. /**
  59. * Método setter
  60. * Establecemos el título del libro
  61. *
  62. * @param titulo - Es el titulo del libro
  63. */
  64.  
  65. public ConstructorLibro (String CLIBC, String titulo) {
  66. establecerLibro(CLIBC);
  67. establecerTitulo(titulo);
  68. }
  69.  
  70.  
  71. } // Fin clase principal Libro
Add Comment
Please, Sign In to add comment