Given the following class. (JAVA)
public class FamilyMember
{
public String drink( ) {return “cup”;}
public String eat( ) {return “fork”;}
}
Write aBaby classthat is derived from the FamilyMember class. The Baby class has aninstance variablefor the age, adefault constructor, and aconstructor that accepts an integer. Includeany other necessary methods. If a baby is older than 3 years, print that “it eats with its fork”; otherwise, “it eats with its hands”.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here