Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package formeGeometriche;
- public class Rettangolo {
- private double latoA;
- private double latoB;
- private double vertice;
- public Rettangolo(){
- this.latoA = 0;
- this.latoB = 0;
- this.vertice = 0;
- }
- public Rettangolo (double latoA, double latoB, double vertice){
- this.latoA = latoA;
- this.latoB = latoB;
- this.vertice = vertice;
- }
- public double getLatoA() {
- return latoA;
- }
- public void setLatoA(double latoA) {
- this.latoA = latoA;
- }
- public double getLatoB() {
- return latoB;
- }
- public void setLatoB(double latoB) {
- this.latoB = latoB;
- }
- public double getVertice() {
- return vertice;
- }
- public void setVertice(double vertice) {
- this.vertice = vertice;
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- long temp;
- temp = Double.doubleToLongBits(latoA);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(latoB);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(vertice);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Rettangolo other = (Rettangolo) obj;
- if (Double.doubleToLongBits(latoA) != Double.doubleToLongBits(other.latoA))
- return false;
- if (Double.doubleToLongBits(latoB) != Double.doubleToLongBits(other.latoB))
- return false;
- if (Double.doubleToLongBits(vertice) != Double.doubleToLongBits(other.vertice))
- return false;
- return true;
- }
- @Override
- public String toString() {
- return "Rettangolo [latoA=" + latoA + ", latoB=" + latoB + ", vertice=" + vertice + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement