Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. public class Car {
  2. private String brand;
  3. private String model;
  4. private String color;
  5. private String engine;
  6. private String transmission;
  7. private String dateCreated;
  8.  
  9. public Car() {
  10.  
  11. }
  12.  
  13. public Car(String brand, String model, String color, String engine, String transmission, String dateCreated) {
  14. this.brand = brand;
  15. this.model = model;
  16. this.color = color;
  17. this.engine = engine;
  18. this.transmission = transmission;
  19. this.dateCreated = dateCreated;
  20. }
  21.  
  22. public String getBrand() {
  23. return brand;
  24. }
  25. public void setBrand(String brand) {
  26. this.brand = brand;
  27. }
  28. public String getModel() {
  29. return model;
  30. }
  31. public void setModel(String model) {
  32. this.model = model;
  33. }
  34. public String getColor() {
  35. return color;
  36. }
  37. public void setColor(String color) {
  38. this.color = color;
  39. }
  40. public String getEngine() {
  41. return engine;
  42. }
  43. public void setEngine(String engine) {
  44. this.engine = engine;
  45. }
  46. public String getTransmission() {
  47. return transmission;
  48. }
  49. public void setTransmission(String transmission) {
  50. this.transmission = transmission;
  51. }
  52. public String getDateCreated() {
  53. return dateCreated;
  54. }
  55. public void setDateCreated(String dateCreated) {
  56. this.dateCreated = dateCreated;
  57. }
  58.  
  59. @Override
  60. public int hashCode() {
  61. final int prime = 31;
  62. int result = 1;
  63. result = prime * result + ((brand == null) ? 0 : brand.hashCode());
  64. result = prime * result + ((color == null) ? 0 : color.hashCode());
  65. result = prime * result + ((dateCreated == null) ? 0 : dateCreated.hashCode());
  66. result = prime * result + ((engine == null) ? 0 : engine.hashCode());
  67. result = prime * result + ((model == null) ? 0 : model.hashCode());
  68. result = prime * result + ((transmission == null) ? 0 : transmission.hashCode());
  69. return result;
  70. }
  71.  
  72. @Override
  73. public boolean equals(Object obj) {
  74. if (this == obj)
  75. return true;
  76. if (obj == null)
  77. return false;
  78. if (getClass() != obj.getClass())
  79. return false;
  80. Car other = (Car) obj;
  81. if (brand == null) {
  82. if (other.brand != null)
  83. return false;
  84. } else if (!brand.equals(other.brand))
  85. return false;
  86. if (color == null) {
  87. if (other.color != null)
  88. return false;
  89. } else if (!color.equals(other.color))
  90. return false;
  91. if (dateCreated == null) {
  92. if (other.dateCreated != null)
  93. return false;
  94. } else if (!dateCreated.equals(other.dateCreated))
  95. return false;
  96. if (engine == null) {
  97. if (other.engine != null)
  98. return false;
  99. } else if (!engine.equals(other.engine))
  100. return false;
  101. if (model == null) {
  102. if (other.model != null)
  103. return false;
  104. } else if (!model.equals(other.model))
  105. return false;
  106. if (transmission == null) {
  107. if (other.transmission != null)
  108. return false;
  109. } else if (!transmission.equals(other.transmission))
  110. return false;
  111. return true;
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement