1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SVEN [57.7K]
2 years ago
5

We need an equals method for the Dog class. It needs to give back to the caller a boolean value indicating whether another objec

t of the same type's attributes are all of the same value as the calling object's. Provide the entire method (header and code), and only the method.
public class Dog {
private String name;
private int age;
private int [] healthScores;
}
Computers and Technology
1 answer:
Nadusha1986 [10]2 years ago
3 0

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.

You might be interested in
Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the outpu
Likurg_2 [28]

Answer:

Following are the program in the C++ Programming Language.

#include <iostream>

using namespace std;

//define function for swapping

void SwapValues(int* userVal1,int* userVal2){  

//set integer variable to store the value

int z = *userVal1;

//interchange their value

*userVal1 = *userVal2;  

//interchange their value

*userVal2 = z;

}

//define main method

int main()

{    

//declare variables

int x,y;

//get input from the user

cin>>x>>y;

//Call the method to swap the values

SwapValues(&x,&y);

//print their values

cout<<x<<" "<<y;

return 0;

}

<u>Output</u>:

3 8

8 3

Explanation:

<u>Following are the description of the program</u>.

  • Firstly, we define required header file and function 'SwapValues()', pass two pointer type integer variables in argument that is 'userVal1' and 'userVal2'.
  • Set integer data type variable 'z' and initialize the value of 'userVal1' in it, then initialize the value of 'userVal2' in 'userVal1' and then initialize the value of 'z' in 'userVal2'.
  • Finally, define the main method in which we set two integer type variables and get input from the user in it then, call and pass those variables and print it.
6 0
3 years ago
1. Do our shared social experiences lead us to think<br><br> communication is a cure-all?
egoroff_w [7]

Answer:

Yes

Explanation:

Shared social illustrations have always shown that any problem of any kind can be sorted by communication.

Eg : Whenever societies face any problem - eg recession, the competent people related to that area of problem (representing different interests of various groups also) sit & discuss (ie communicate in detail) about it.  

These communications have seen to be solution to all problems world has faced.

3 0
3 years ago
Who watches the show gravity falls, if you do, if you play the theme song for the first episode backwards you get a hiding messi
Yakvenalex [24]
I don’t really knowwww but thanks
4 0
2 years ago
Read 2 more answers
Which task can a company perform with intranets
Irina-Kira [14]

Answer:

C.) store data securely would be my choice

Hope This Helps!  Have A Nice Day!!

6 0
3 years ago
Three homework questions I can't figure out, please help?
Burka [1]

It A

iT b

YOU CANT TRY THE TWO ONE THE WHO ARE WRITE

8 0
2 years ago
Other questions:
  • I NEED HELP NOW PLEASE!!!!!!
    6·2 answers
  • An example of software most commonly associated with productivity software is ____.
    12·1 answer
  • Does anyone know how to cancel a Pandora Free Trial Subscription? I need to cancel it by tomorrow. Please help!
    12·1 answer
  • Which of the following represent emerging classes of application software? Check all of the boxes that apply.
    9·3 answers
  • Which of the following is NOT a component of a DFD?
    8·1 answer
  • Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the cou
    13·1 answer
  • What are the specifications for a mine shaft headgear ​
    10·1 answer
  • Please help!!
    6·1 answer
  • Most of the energy we use originally came from:
    8·1 answer
  • What is the correct format to use when<br> inserting a date in Excel?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!