solve this by arraylist in the last of the question it has been told
Create an arraylist of type PetOwner and then by asking about type of pet one want add that type pet to the arraylist.
e.g. if(choice== cat){
Cat cat=new Cat(“meow”);
PetOwner p=new PetOwner(“ali”,cat)’;
arraylist.add(p);
}
Same for dog and fish, at the end print arraylist also call eat and walk methods.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here