Write an application namedUseChildrenthat creates and displays at least two Childobjects—oneMaleand oneFemale.Childis an abstract class andMaleand Femaleare subclasses. TheChildclass contains fields that hold the name, gender, and age of a child. TheChildclass constructor requires a name and a gender. The Childclass also contains two abstract methods namedsetAge()anddisplay().
TheMaleandFemalesubclass constructors require only a name; they pass the name and appropriate gender to theChild. The subclass constructors also prompt the user for an age using thesetAge()method, and then display the Child’s data using thedisplay()method. Save the files as Child.java, Male.java, Female.java, and UseChildren.java.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here