Question: Answer the question based on the program segment below. public class Mother public String name: public int age: Mother name=Aminah: age 45 1 public void

 Answer the question based on the program segment below. public class

Answer the question based on the program segment below. public class Mother public String name: public int age: Mother name="Aminah: age 45 1 public void display System.out.println("Name:" +name); System.out.println("Age: "+age): 1 D. Create a class named Child that inherits the Mother class. (3 marks) Declare an instance name location (String) for class Child. 11). Define a constructor in class Child and give an appropriate initial values for the instances (name, age, location) 13 marks) 111). Define a method display() in class Child, execute the display method in superclass using the keyword super. Method display() in class child should print the information of name, age and location. (3 marks) iv). Create other class named Main for the main method and create 2 objects for the 2 classes (Mother and Child). Then execute the display() method for Mother and Child. (6 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!