Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide the java code for the above question. Please dont post the code as images. 1 Has a Relationship(Array) Since you have learned inheritance,
Please provide the java code for the above question. Please dont post the code as images.
1 Has a Relationship(Array) 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 email String Create a class named Employee with the following private attributes. Attributes Datatype String dept String salary Integer Include appropriate getters and setters. Create a default and parameterized constructor for both the classes. Create an object array 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 array 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 Public void showEmployee HasADetails) Description Displays the Employee details such as 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 display the output in the console. Input Format First line of the input consist of the number of inputs to be given Next input is the details of person and their employment. Refer sample input. Output Format Output displays the person details and their employment details. Refer sample output Sample Testcases Testcase 1 Input Testcase 1 Output Rayon 9098776556 Sydney rayon@gmail.com E01 Marketing 100000 Eliza 9766678998 New York eliza@gmail.com E02 Development 200000 Rayon 9098776556 Sydney rayon@gmail.com E01 Marketing 100000 Eliza 9766678998 New York - - - thi - - Mong Sample Testcases Testcase 1 Output Testcase 1 Input yuncy rayon@gmail.com E01 Marketing 100000 Rayon 9098776556 Sydney rayon@gmail.com E01 Marketing 100000 Eliza 9766678998 New York eliza@gmail.com E02 Development 200000 Eliza 9766678998 New York eliza@gmail.com E02 Development 200000Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started