Question: Please provide the java code for the above question. Please dont post the code as images. 2 Has a Relationship Since you have learned inheritance,

 Please provide the java code for the above question. Please dontpost the code as images. 2 Has a Relationship Since you havelearned inheritance, it is important to understand the relationships between them. Lets

Please provide the java code for the above question. Please dont post the code as images.

2 Has a Relationship Since you have learned inheritance, it is important to understand the relationships between them. Lets explore the has-a relationship between the classes. When you inherit a class from base class then the derived class has has a relationship with the base class. Create a class named Person with the following private attributes. Attributes Datatype name String mobile String city String String email Create a class named Employee with the following private attributes. Attributes Datatype id String dept String salary Integer Include appropriate getters and setters. Create a default and parameterized constructor for both the classes. Create an object for Person class and after getting the inputs, call the display method present in the Person class to display the details. Method Public void display() Description Displays the person details such as name, mobile, email and city. Create an object for employee class and get both the person and employee details, call the display method present inside the Employee class to display the details. Method Description Public void Displays the Employee details such as showEmployee HasAD id, department and salary along with their personal details such as name, mobile, email and city. Create a driver class Main to obtain the input from user and displays the output in the console. Input Format Input consists of the details of a person and their employment details. Refer sample input. Output Format Output prints the details of person and their employment details. Refer sample output Sample Testcases Testcase 1 Input Testcase 1 Output Williams 9756789951 Williams 9756789951 Kolkata williams@gmail.com E01 Marketing 10000 Kolkata williams@gmail.com E01 Marketing 10000

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!