Create a Web application that uses JSF.
Create an Animal class that has a field called name. This class needs to use the annotations @Named and @RequestScoped so you will need the following import statements:
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
Make two qualifiers called CatAnimal and DogAnimal. Create an AnimalController class that will inject either a CatAnimal or a DogAnimal, run tests to make sure both work.
Create a Cat and a Dog class that extends the Animal class. Add a field called speak and set it to meow for the cat and woof for the dog. You will need get and set methods for speak.
Create a page to enter the name of the cat and another page to enter the name of a dog.
Then create a page to display the name entered and what the animal says (speak). You will need one for the cat and one for the dog.
Here is how my project looks: see image.
To run this you will need code in the AnimalController class for either the cat or the dog. So if I set mine up for the cat see image.
and run catDataEntry.xhtml, the results look like this: see image.