Step-by-step explanation:
Below is the java code for the ladtract class :-
public class ladtract
{
private double length; //length of tractor
private double width; //width of tractor
public double calculateArea(){
return length*width; //calculate and return the area of the tractor
}
public boolean equals(Object o) {
if (o == this) { //check if it's the same object
return true;
}
if(o.length==this.length && o.width==this.width){ //check if the length and width are same for both objects
return true;
}
return false;
}
public String toString(){
return "Area="+calculateArea(); //return the area of the tractor as a string
}
}