Question: Write a JAVA code to implement the following: 1. Create a super class named Human, that has the following members: (.25 Point) a private String

Write a JAVA code to implement the following:
1. Create a super class named Human, that has the following members: (.25 Point)
a private String attribute name (.25 Point)
constructor to initialize the attribute name. (.25 Point)
set method to change the values of name. (.25 Point)
get method to return the values of name. (.25 Point)
override method toString to print the value of name. (.5 Point)
2. Create a sub class named Employee that,
inherits from superclass Human (.5 Point)
has a private attribute ID (.25 Point)
constructor to initialize the attributes name
(via superclass constructor) and ID. (0.5 Point)
3. Write a Test class that has the main method:
Declare a reference e of Employee class (.25 point)
Create an object of Employee class (with name Ahmed and 123 ID)
and assign it to the e reference (.5 point)
Call toString method to print the name and ID. (.25 point)

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!