Question: Java Can you show it? By implementing into the code! The PetDatabase class has a public method called deleteCats. It takes one parameter, age of

Java

Can you show it? By implementing into the code!

Java Can you show it? By implementing into the code! The PetDatabase

class has a public method called deleteCats. It takes one parameter, age

The PetDatabase class has a public method called deleteCats. It takes one parameter, age of int type, and deletes the cats that are older than the given age. It retums the number of cats deleted Which one is the correct definition of the method? Select one public int deleteCats(int age) { Int count ; for (int k = 8; * age) { cats.remove(); count return count; public int deleteCats(int age) Int count = 0; int k-cats.size(); while (>0){ if (cats.get().getAge() it = cats.iterator(); while (it.hasNext()) { if ( it.next().getAge() > age ) { it.remove(); count++; } return count; } public int deleteCats(int age) { int count = 0; for (Cat c: cats) { if (c.getAge() > age ) { cats.remove(c); count++; } 1 return count; }

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!