} Given below are the definition of class Person and Employee. public class Person ( private...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
} Given below are the definition of class Person and Employee. public class Person ( private String name: public Person (String name) { this.name name; ) ) public String getName () { return name: 1 public class Employee extends Person private int id: } public void display() () public Employee (String n, int i) { super (n); id - 1/ } public void display() ( System.out.println("Name= " +getName()+", ID="id); public void display (char c) ( System.out.println(c+" Name="getName()+" ID="id""+c); Based on the above class definitions, the following variables are declared: Person p: Employee e Answer all of the following questions: a) Write a Java statement that demonstrates the concept of polymorphic reference. (2 marks) b) Write a Java statement that demonstrates the concept of polymorphic behaviour. (2 marks) c) Which method demonstrates the concept of method overriding in the Employee class? (1 mark) d) Which method demonstrates the concept of method overloading in the Employee class? (1 mark) e) Suppose that one of the two classes is to be defined as abstract class. Which class and which method in the class are the most suitable to be defined as abstract? (2 marks) } Given below are the definition of class Person and Employee. public class Person ( private String name: public Person (String name) { this.name name; ) ) public String getName () { return name: 1 public class Employee extends Person private int id: } public void display() () public Employee (String n, int i) { super (n); id - 1/ } public void display() ( System.out.println("Name= " +getName()+", ID="id); public void display (char c) ( System.out.println(c+" Name="getName()+" ID="id""+c); Based on the above class definitions, the following variables are declared: Person p: Employee e Answer all of the following questions: a) Write a Java statement that demonstrates the concept of polymorphic reference. (2 marks) b) Write a Java statement that demonstrates the concept of polymorphic behaviour. (2 marks) c) Which method demonstrates the concept of method overriding in the Employee class? (1 mark) d) Which method demonstrates the concept of method overloading in the Employee class? (1 mark) e) Suppose that one of the two classes is to be defined as abstract class. Which class and which method in the class are the most suitable to be defined as abstract? (2 marks)
Expert Answer:
Answer rating: 100% (QA)
a An example of polymorphic reference in Java is Person p new EmployeeJohn 1234 Here the reference v... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The quarterly sales for a software product over the past three years are given in the table below. 1) Forecast the demand for year 4 using the moving average technique for 3 periods. 1) Compute the...
-
It is July 15, 2014. A friend, who works in the office of a local company that has four fast food restaurants, has come to you with a question. She knows you are studying accounting and asks if you...
-
Suppose we are interested in a particular Weibull distribution with pdf Determine a method to generate random observations from this Weibull distribution. If access is available, write an R function...
-
Fraud deterrence is centered on the fear of getting caught and the fear of getting punished. In your opinion, which is stronger and why?
-
Fred and Sally Merrit recently inherited a substantial amount of money from a deceased relative. They want to use part of this money to establish an account to pay for their daughters college...
-
1 Problem 4 - A firm's optimal output choice (10 points) Consider a price taking firm, where the market price for the output is given by P. The firm's output choice is denote by Q. The firm has a...
-
Kinkaid Co. is incorporated at the beginning of this year and engages in a number of transactions. The following journal entries impacted its stockholders equity during its first year of operations....
-
Consider the following template function implementation. The 'Item' can be any class with the following properties: template Item maximum (Item a, Item b) { } if (a > b) else return a; return b; With...
-
Task: investigate one of the following organizations - or another if you choose Good Neighbours Canada Feed Ontario Hamilton Food Share Community Food Centres Hamilton Food4Kids Hamilton Tastebuds...
-
The following questions are included on the internal control questionnaire for Ingrid Company related to cash. 1. Do different people handle cash and maintain the records of cash receipts? 2. Is a...
-
Discuss the process that must have been used to choose the location for UNIQLO retail site in Japan. Explain five most important factors UNIQLO took into considerations. Give evidences from the case...
-
There are many misconceptions about who entrepreneurs are and what motivates them to launch firms to develop their ideas. Some misconceptions develop because of the media covering a typical...
-
Discuss the chip shortage issue around the world. Which industries affected by the shortage? Who are the main chip suppliers/designer for the world (check their stock market price before vs. during...
-
The following situations involve Shirley Gaas, Bryan Qian, Yu Jiang and Brett Thompson, staff accountants with the CPA firm of Sumikawa and Zhu. Brett Thompsons acquaintance, Yushan Jiu, is chief...
-
You are a U.S. investor who purchased British securities for 2,000 one year ago when the British pound cost U.S. $1.50. What is your total return (based on U.S. dollars) if the value of the...
-
Go to the LearnChemE screencasts link for Chapter 7(http://www.umich.edu/~elements/6e/07chap/learn-cheme-videos.html). 1. View the two screencasts on nonlinear regression and describe or list any...
-
In order to study the photochemical decay of aqueous bromine in bright sunlight, a small quantity of liquid bromine was dissolved in water contained in a glass battery jar and placed in direct...
-
Consider the elementary gas-phase reversible reaction is carried out isothermically A 3C Pure A enters at a temperature of 400 K and a pressure of 10 atm. At this temperature, K C = 0.25(mol/dm 3 )...
-
Classic LEGO plastic bricks have been fixtures in homes around the world for more than 70 years. Just 15 years ago, The LEGO Group (TLG) was near bankruptcy, spiraling downward and losing money at a...
-
For a sample of data where n = 7 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z score....
-
For a sample of data where n = 6 given below: a. Calculate the mean, median, and mode. b. Calculate the range, variance, standard deviation, and coefficient of variation. c. Calculate the Z scores....
Study smarter with the SolutionInn App