Add a new java interface training in this interface you


Copy the previous application to a new folder, open it in Netbeans and rename it to "PolymorphismExample"

2.1 Add abstract key word to People and Employee class

2.2 For each class, override the Display method. For different class, different information should be displayed.
For Student, display: This is student [firstname] [lastname]
For Employee, display: This is Employee [firstname] [lastname] with EmployeeID [EmployeeID]
For Faculty, display: This is Faculty [firstname] [lastname] with EmployeeID [EmployeeID]
For Staff, display: This is Staff [firstname] [lastname] with EmployeeID [EmployeeID]

2.3 After you have built a Hierarchy of inherited classes, in you main application, please do following:
A. Create a new People object, with all 4 parameters
B. Create a new Student object, with 2 parameters
C. Create a new Faculty object, with all 6 parameters
D. Create a new Staff object, with all 6 parameters
E. Call all previous 4 objects' Display() function

2.4 Add a new java Interface "Training". In this Interface, you should have a method call "EmployeeTrain()". Make Employee class implements this Interface. Then add this method to subclass of Employee. In Faculty class, EmployeeTrain method will print "Faculty is trained.". In Staff class, EmployeeTrain method will print "Staff is trained." Now in your application, please call your Faculty and Staff objects' EmployeeTrain method.

2.5 Java upcasting and downcasting:

2.5.1 Upcasting: Java permits an object of a subclass type to be treated as an object of any superclass type. This is called upcasting.
Please upcasting a Faculty object to an Employee object, and call its Display function.

Then in your system.out.println, explain which Display method is called, Faculty.Display? or Employee.Display? or People.Display? Why?

2.5.2 Downcasting: Java permits an object of a superclass type to be treated as an object of any subclass type. This is called downcasting.
Please :
1. Upcasting a Faculty object to an Employee object,
2. Then downcasting this Employee object to Faculty object
3. Then call its Display function.
Then in your system.out.println, explain which Display method is called, Faculty.Display? or Employee.Display? or People.Display? Why?

Attachment:- Previous Application.zip

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Add a new java interface training in this interface you
Reference No:- TGS02398286

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)