Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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

Java, Programming

  • Category:- Java
  • Reference No.:- M92411457
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As