Answer:
Java.
Explanation:
public class Rectangle {
private int x;
private int y;
private int width;
private int height;
///////////////////////////////////////////////////////////
public Rectangle(int inX, inY, inWidth, inHeight) {
x = inX;
y = inY;
width = inWidth;
height = inHeight;
}
///////////////////////////////////////////////////////////
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
///////////////////////////////////////////////////////////
public int getArea() {
return width * height;
}
public bool isSquare() {
if (width == height) {
return true;
}
else
return false;
}
///////////////////////////////////////////////////////////
public String toString() {
return "Rectangle located at (" + x + "," + y + ")" + "with dimensions " + width + "x" + height + "and " + getArea() + "is the area.";
}
}
Answer and Explanation:
Using Javascript:
Class Dog{
var healthScores=[];
Constructor(name, age, ...healthScores) {this.name=name;
this.age=age;
this.healthsScores=healthScores;
}
checkObject(new Dog){
If(new Dog.name===this.name,new Dog.age===this.age, new Dog.healthScores===this.healthScores){return true;
}
else{
console.log("objects are not equal");
}
}
}
To call the method checkObject:
var Tesa = new Dog(Tes,1,[45,46,82]);
var Bingo = new Dog(bing,2,[43,46,82]);
Bingo.checkObject(Tesa);
Note: we have used ES6(latest version of Javascript) where we passed the healthScore parameter(which is an array) to our constructor using the spread operator.