Daily Challenges July 2026 - Pet Age Calculator

Tell us what’s happening:
Describe your issue in detail here.

it is not taking int data type and consistently asking to check the function definition line but as per me I have written access specified, data type ,the

Your code so far

class pets
{
public int petYears(String pet,int age)
 {
  switch(pet)
  {
   case"dog"
   age*=7;
   break;
   case"cat"
   age*=6;
   break;
   case"rabbit"
   age*=8;
   break;
   case"hamster"
   age*=30;
   break;
   case"guinea pig"
   age*=12;
   break;
   case"goldfish"
   age*=6;
   break;
   case"bird"
   age*=5;
   break;
  }
  return age;
}//function ends
}//class ends

Your mobile information:

SM-J600G - Android 10 - Android SDK 29

Challenge: Daily Challenges July 2026 - Pet Age Calculator

Link to the challenge:
https://www.freecodecamp.org/learn/daily-challenges/daily-challenges-july-2026/

Welcome to the forum @srivastavaaditi163 ,

This was the starting code for this JavaScript challenge:

function petYears(pet, age) {
  return pet;
}

But it looks like you have tried to create a class (in Java) instead.

Happy coding