Question: Define a class 'Human' having data members name and gender. Create classes 'Woman' and 'Man' derived from 'Human' having data member age in both.

Define a class 'Human' having data members name and gender. Create classes

 

Define a class 'Human' having data members name and gender. Create classes 'Woman' and 'Man' derived from 'Human' having data member age in both. Both classes must have a constructor to initialize all data members (including super class). Create 6 objects, 3 objects of 'Man' and 3 objects 'Woman'. Define method find (), this must implement the override method in the super class 'Human' to pass objects of 'Man' and 'Woman'. This method should display all the information and it will find who is the senior person and who is younger person. Write a test program that: Creates an Array of object named List to holds the created objects (you can create it either in the main class or as a sperate method). Adds the 6 human objects in the List array, by asking the user, how many persons you want to enter. Then start to enter the person's information by keyboard. Displays the women and men information's The information that your program should be displayed are: - Name, gender, and age. - The senior person with his/her information (Name, gender, and age). Younger person with his/her information (Name, gender, and age).

Step by Step Solution

3.44 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answerpublic class Human String name String gender public static void main String ar... View full answer

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 Programming Questions!