1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mazyrski [523]
3 years ago
15

Write 3 classes with three levels of hierarchy: Base, Derive (child of base), and D1 (child of Derive class). Within each class,

create a "no-arg" method with the same signature (for example void m1( ) ). Each of this method (void m1( ) ) displays the origin of the Class type. Write the TestDynamicBinding Class: (the one with the ‘psvm’ ( public static void main (String[] args)) to display the following. You are NOT allowed to use the "standard object.m1() "to display the message in the main(…) method. That would NOT be polymorphic! (minus 10 points for not using polymorphic method) Explain why your solution demonstrates the dynamic binding behavior
Engineering
1 answer:
PIT_PIT [208]3 years ago
6 0

Answer:

class Base

{

void m1()

{

System.out.println("Origin: Base Class");

}

}

class Derive extends Base

{

void m1()

{

System.out.println("Origin: Derived Class");

}

}

class D1 extends Derive

{

void m1()

{

System.out.println("Origin: D1 - Child of Derive Class");

}

}

class TestDynamicBinding

{

public static void main(String args[])

{

Base base = new Base(); // object of Base class

Derive derive = new Derive(); // object of Derive class

D1 d1 = new D1(); // object of D1 class

 

Base reference; // Reference of type Base

reference = base; // reference referring to the object of Base class

reference.m1();   //call made to Base Class m1 method

 

reference = derive;   // reference referring to the object of Derive class

reference.m1(); //call made to Derive Class m1 method

 

reference = d1;    // reference referring to the object of D1 class

reference.m1(); //call made to D1 Class m1 method

}

}

Explanation:

The solution demonstrates dynamic binding behavior because the linking procedure used calls overwritten method m1() is made at run time rather than doing it at the compile time. The code to be executed for this specific procedural call is also known at run time only.

You might be interested in
Steam at 20 bars is in the saturated vapor state (call this state 1) and contained in a pistoncylinderdevice with a volume of 0.
saul85 [17]

Answer:

Explanation:

Given that:

<u>At state 1:</u>

Pressure P₁ = 20 bar

Volume V₁ = 0.03 \mathbf{m^{3}}

From the tables at saturated vapour;

Temperature T₁ = 212.4⁰ C  ; v_1 = vg_1 = 0.0996 \mathbf{m^{3}} / kg

The mass inside the cylinder is m = 0.3 kg, which is constant.

The specific internal energy u₁ = ug₁ = 2599.2 kJ/kg

<u>At state 2:</u>

Temperature T₂ = 200⁰ C

Since the 1 - 2 occurs in an isochoric process v₂ = v₁ = 0.099 \mathbf{m^{3}} / kg

From temperature T₂ = 200⁰ C

v_f_2 = 0.0016 \ m^3/kg  

vg_2 = 0.127 \ m^3/kg  

Since  vf_2 < v_2 , the saturated pressure at state 2 i.e. P₂ = 15.5 bar

Mixture quality x_2 = \dfrac{v_2-vf_2}{vg_2 -vf_2}

x_2 = \dfrac{(0.099-0.0016)m^3/kg}{(0.127 -0.0016) m^3/kg}

x_2 = \dfrac{(0.0974)m^3/kg}{(0.1254) m^3/kg}

\mathsf{x_2 =0.78}

At temperature T₂, the specific internal energy u_f_2 = 850.6 \ kJ/kg , also ug_2 = 2594.3 \ kJ/kg

Thus,

u_2 = uf_2 + x_2 (ug_2 -uf_2)

u_2 =850.6  +0.78 (2594.3 -850.6)

u_2 =850.6  +1360.086

u_2 =2210.686 \ kJ/kg

<u>At state 3:</u>

Temperature T_3=T_2 = 200 ^0 C ,

V_3 = 2V_1 = 0.06 \ m^3

Specific volume v_3 = 0.2  \ m^3/kg

Thus; vg_3 =vg_2 = 0.127 \ m^3/kg ,

SInce v_3 > vg_3, therefore, the phase is in a superheated vapour state.

From the tables of superheated vapour tables; at v_3 = 0.2  \ m^3/kg and T₃ = 200⁰ C

The pressure = 10 bar and v =0.206 \ m^3/kg

The specific internal energy u_3 at the pressure of 10 bar = 2622.3 kJ/kg

The changes in the specific internal energy is:

u_2-u_1

= (2210.686 - 2599.2) kJ/kg

= -388.514 kJ/kg

≅ - 389 kJ/kg

u_3-u_2

= (2622.3 - 2210.686)  kJ/kg

= 411.614 kJ/kg

≅ 410 kJ/kg  

We can see the correct sketches of the T-v plot showing the diagrammatic expression in the image attached below.

3 0
3 years ago
A formal indication from a state, on letterhead, or an official state form, that shows the applicant has valid driving privilege
alex41 [277]

A formal indication from a state, on letterhead, or an official state form, which shows that an applicant has valid driving privileges and is clear to apply for a Colorado driver's license is called a clearance.

<h3>What is a learner's license?</h3>

A learner's license is also referred to as learner's permit and it can be defined as a category of driver's license that is issued to an individual who is learning how to drive an automobile vehicle (car).

<h3>What is a license?</h3>

A license is also referred to as a certificate and it can be defined as an authorization that is typically issued by state governments to a driver, so as to avail him or her the legal ability to physically driver in all the states across a country.

In this scenario, we can infer and logically deduce that a clearance is a formal indication from a state which shows and affirms that an applicant has valid driving privileges, and is permitted to apply for a Colorado driver's license.

Learn more about learner's license here: brainly.com/question/26289148

#SPJ1

7 0
1 year ago
2. A mild steel wire of radius 0.5mm and length 3m is stretched by a force of 49 N. Calculate:
damaskus [11]
I don’t know how to answer :’(
6 0
2 years ago
What are the advantages and disadvantages of a mine heardgear​
Irina18 [472]

Answer:

If there is a shaft with headgear, then mining can take place until that depth of the shaft. If it is accessed horizontal Adits, it can mine until the lowest Adit from upwards. If it is accessed decline, the development and mining can continue so long as economic exploitation is possible.

Explanation:

What are the disadvantages of mining headgear? They totally cut off your vision of anything above your head. They are hot, most of the time

7 0
1 year ago
You are NASA. Build a space station on Mars that could support humans to live in for an extended period of time.
Ierofanga [76]
Literally just do the project
3 0
2 years ago
Other questions:
  • At the instant under consideration, the hydraulic cylinder AB has a length L = 0.75 m, and this length is momentarily increasing
    7·2 answers
  • In Victorious, when everyone was trapped in the RV, who wasn’t? And what were they doing??
    10·1 answer
  • ¿Por qué creen que la Ingeniería Metalúrgica es una carrera estratégica para el desarrollo de nuestro país?
    9·1 answer
  • Water (cp = 4180 J/kg·°C) enters the 2.5 cm internal diameter tube of a double-pipe counter-flow heat exchanger at 17°C at a rat
    7·1 answer
  • Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's
    11·2 answers
  • Do all websites use the same coding to create?
    8·1 answer
  • Which statement concerning symbols used on plans is true?
    10·1 answer
  • THIS IS NOT AN ACADEMIC QUESTION, but who was the bitter of 1987 in FNAF?
    6·2 answers
  • What is the minimum clamp time for gluing a panel?
    7·1 answer
  • Draw the schematics for the following two battery connections. Can you explain the value of the output voltage in the series con
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!