Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 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.  
  12. public String toCSV() {
  13. return title + "; " + author + "; " + house + "; " + publishment + "; " + number;
  14. }
  15.  
  16. Book(String string, String string0) {
  17. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  18. }
  19.  
  20.  
  21. public Book(String author, String title, String publishment, String number, String house) {
  22. this.author = author;
  23. this.title = title;
  24. this.publishment = publishment;
  25. this.number = number;
  26. this.house = house;
  27. }
  28.  
  29.  
  30. public String getAuthor() {
  31. return author;
  32. }
  33.  
  34. public void setAuthor(String author) {
  35. this.author = author;
  36. }
  37.  
  38. public String getTitle() {
  39. return title;
  40. }
  41.  
  42. public void setTitle(String title) {
  43. this.title = title;
  44. }
  45.  
  46. public String getPublishment() {
  47. return publishment;
  48. }
  49.  
  50. public void setPublishment(String publishment) {
  51. this.publishment = publishment;
  52. }
  53.  
  54. public String getNumber() {
  55. return number;
  56. }
  57.  
  58. public void setNumber(String number) {
  59. this.number = number;
  60. }
  61.  
  62. public String getHouse() {
  63. return house;
  64. }
  65.  
  66. public void setHouse(String house) {
  67. this.house = house;
  68. }
  69.  
  70. @Override
  71. public int compareTo(Book c) {
  72. return this.author.compareTo(c.author);
  73. }
  74.  
  75. @Override
  76. public String toString() {
  77. return title + "; " + author + "; " + house + "; " + publishment + "; " + number;
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement