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. Since you have learned inheritance, it is important to
Please provide the java code for the above question. Please dont post the code as images.
Since you have learned inheritance, it is important to understand the relationships between them. Lets explore the is-a relationship between the classes. When you inherit a class from base class then the derived class has is a relationship with the base class. Create a class named Person with the following private attributes. Attributes Datatype name String mobile String email String city String Create a class named Employee with the following private attributes. Attributes Datatype Integer dept String salary Integer Include appropriate getters and setters. Create a default and parameterized constructor for both the classes. The class person includes the following method. Method Description Public void person Display() Displays the person details such as name, mobile, email and city. The class Employee includes the following mwthod. Method Public void employee Display Description Displays the Employee details such as id, department and salary along with their personal details such as name, mobile, email and city. Call the person Display method inside employee Display method. Create an object for employee class and get both the person and employee details, call the employeeDisplay method present inside the Employee class that in turn calls the person Display method present inside the Person class to display the details. Understand the relationship between them. Input Format The input consists of the employee details. Output Format The output displays the employee details. Refer sample input and output. Sample Testcases Testcase 1 Input Testcase 1 Output Alice 9898989878 alice@gmail.com Coimbatore 8 Sales 10000 Alice 9898989878 alice@gmail.com Coimbatore 08 Sales 10000Step 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