Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions