Question: The following method is designed to return true if the passed phrase contains either the word cat or dog. public boolean containsPet ( String input

The following method is designed to return true if the passed phrase contains either the word cat or dog.
public boolean containsPet(String input){
if (input.indexOf("cat")>=0)
{
return true;
}
else if (input.indexOf("dog")>=0)
{
return true;
}
else
{
return false;
}
}
Which of the following test cases can be used to show the code does NOT work as intended?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!