Advertisement
Guest User

Rettangolo

a guest
Mar 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. package formeGeometriche;
  2.  
  3. public class Rettangolo {
  4. private double latoA;
  5. private double latoB;
  6. private double vertice;
  7.  
  8. public Rettangolo(){
  9. this.latoA = 0;
  10. this.latoB = 0;
  11. this.vertice = 0;
  12.  
  13. }
  14. public Rettangolo (double latoA, double latoB, double vertice){
  15. this.latoA = latoA;
  16. this.latoB = latoB;
  17. this.vertice = vertice;
  18. }
  19. public double getLatoA() {
  20. return latoA;
  21. }
  22. public void setLatoA(double latoA) {
  23. this.latoA = latoA;
  24. }
  25. public double getLatoB() {
  26. return latoB;
  27. }
  28. public void setLatoB(double latoB) {
  29. this.latoB = latoB;
  30. }
  31. public double getVertice() {
  32. return vertice;
  33. }
  34. public void setVertice(double vertice) {
  35. this.vertice = vertice;
  36. }
  37. @Override
  38. public int hashCode() {
  39. final int prime = 31;
  40. int result = 1;
  41. long temp;
  42. temp = Double.doubleToLongBits(latoA);
  43. result = prime * result + (int) (temp ^ (temp >>> 32));
  44. temp = Double.doubleToLongBits(latoB);
  45. result = prime * result + (int) (temp ^ (temp >>> 32));
  46. temp = Double.doubleToLongBits(vertice);
  47. result = prime * result + (int) (temp ^ (temp >>> 32));
  48. return result;
  49. }
  50. @Override
  51. public boolean equals(Object obj) {
  52. if (this == obj)
  53. return true;
  54. if (obj == null)
  55. return false;
  56. if (getClass() != obj.getClass())
  57. return false;
  58. Rettangolo other = (Rettangolo) obj;
  59. if (Double.doubleToLongBits(latoA) != Double.doubleToLongBits(other.latoA))
  60. return false;
  61. if (Double.doubleToLongBits(latoB) != Double.doubleToLongBits(other.latoB))
  62. return false;
  63. if (Double.doubleToLongBits(vertice) != Double.doubleToLongBits(other.vertice))
  64. return false;
  65. return true;
  66. }
  67. @Override
  68. public String toString() {
  69. return "Rettangolo [latoA=" + latoA + ", latoB=" + latoB + ", vertice=" + vertice + "]";
  70. }
  71.  
  72.  
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement