Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. package aplikacjabiblioteczna;
  2.  
  3. //comparable -> alfabetyczne sortowanie wyników
  4. public class Book implements Comparable<Book> {
  5. private String author; //autor
  6. private String title; //tytuł
  7. private String publishment; //rok wydania
  8. private String number; //numer ewidencyjny
  9. private String house; //wydawnictwo
  10.  
  11. public Book(String author, String title, String publishment, String number, String house) {
  12. this.author = author;
  13. this.title = title;
  14. this.publishment = publishment;
  15. this.number = number;
  16. this.house = house;
  17. }
  18.  
  19. Book(String author, String title) {
  20. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  21. }
  22.  
  23.  
  24. public String getAuthor() {
  25. return author;
  26. }
  27.  
  28. public void setAuthor(String author) {
  29. this.author = author;
  30. }
  31.  
  32. public String getTitle() {
  33. return title;
  34. }
  35.  
  36. public void setTitle(String title) {
  37. this.title = title;
  38. }
  39.  
  40. public String getPublishment() {
  41. return publishment;
  42. }
  43.  
  44. public void setPublishment(String publishment) {
  45. this.publishment = publishment;
  46. }
  47.  
  48. public String getNumber() {
  49. return number;
  50. }
  51.  
  52. public void setNumber(String number) {
  53. this.number = number;
  54. }
  55.  
  56. public String getHouse() {
  57. return house;
  58. }
  59.  
  60. public void setHouse(String house) {
  61. this.house = house;
  62. }
  63.  
  64. @Override
  65. public int compareTo(Book c) {
  66. return this.author.compareTo(c.author);
  67. }
  68.  
  69. @Override
  70. public String toString() {
  71. return title + "; " + author + "; " + house + "; " + publishment + "; " + number;
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement