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
A robot was able to detect a burning smell at a shopping mall and prevent a major disaster. Which function enabled the robot to
adelina 88 [10]

Answer:

Smoke detectors on the robot.

Plz rate as Brainliest. I need it to get to the next rank.

3 0
3 years ago
An Ideal gas is being heated in a circular duct as while flowing over an electric heater of 130 kW. The diameter of duct is 500
max2010maxim [7]

Answer: The exit temperature of the gas in deg C is 32^{o}C.

Explanation:

The given data is as follows.

C_{p} = 1000 J/kg K,   R = 500 J/kg K = 0.5 kJ/kg K (as 1 kJ = 1000 J)

P_{1} = 100 kPa,     V_{1} = 15 m^{3}/s

T_{1} = 27^{o}C = (27 + 273) K = 300 K

We know that for an ideal gas the mass flow rate will be calculated as follows.

     P_{1}V_{1} = mRT_{1}

or,         m = \frac{P_{1}V_{1}}{RT_{1}}

                = \frac{100 \times 15}{0.5 \times 300}

                = 10 kg/s

Now, according to the steady flow energy equation:

mh_{1} + Q = mh_{2} + W

h_{1} + \frac{Q}{m} = h_{2} + \frac{W}{m}

C_{p}T_{1} - \frac{80}{10} = C_{p}T_{2} - \frac{130}{10}

(T_{2} - T_{1})C_{p} = \frac{130 - 80}{10}

(T_{2} - T_{1}) = 5 K

T_{2} = 5 K + 300 K

T_{2} = 305 K

           = (305 K - 273 K)

           = 32^{o}C

Therefore, we can conclude that the exit temperature of the gas in deg C is 32^{o}C.

7 0
3 years ago
Find the total amount of heat in Q lost through a wall 10' by 18' , with R value from q. 1. Inside temperature is 70 degrees F w
marissa [1.9K]

Answer:

Just think

Explanation:

6 0
4 years ago
Read 2 more answers
A 3-phase , 1MVA, 13.8kV/4160V, 60 Hz, transformer with Y-Delta winding connection is supplying a3-phase, 0.75 p.u. load on the
Tanya [424]

Answer:

a) 23.89 < -25.84 Ω

b) 31.38 < 25.84 A

c) 0.9323 leading

Explanation:

A) Calculate the load Impedance

current on load side = 0.75 p.u

power factor angle = 25.84

I_{load} = 0.75 < 25.84°

attached below is the remaining part of the solution

<u>B) Find the input current on the primary side in real units </u>

load current in primary = 31.38 < 25.84 A

<u>C) find the input power factor </u>

power factor = 0.9323 leading

<em></em>

<em>attached below is the detailed solution </em>

8 0
3 years ago
Water is flowing at a rate of 0.15 ft3/s in a 6 inch diameter pipe. The water then goes through a sudden contraction to a 2 inch
Georgia [21]

Answer:

Head loss=0.00366 ft

Explanation:

Given :Water flow rate Q=0.15 \frac{ft^{3}}{sec}

         D_{1}= 6 inch=0.5 ft

        D_{2}=2 inch=0.1667 ft

As we know that Q=AV

A_{1}\times V_{1}=A_{2}\times V_{2}

So V_{2}=\frac{Q}{A_2}

     V_{2}=\dfrac{.015}{\frac{3.14}{4}\times 0.1667^{2}}

     V_{2=0.687 ft/sec

We know that Head loss due to sudden contraction

           h_{l}=K\frac{V_{2}^2}{2g}

If nothing is given then take K=0.5

So head lossh_{l}=(0.5)\frac{{0.687}^2}{2\times 32.18}

                                    =0.00366 ft

So head loss=0.00366 ft

4 0
3 years ago
Other questions:
  • A well insulated turbine operates at steady state. Steam enters the turbine at 4 MPa with a specific enthalpy of 3015.4 kJ/kg an
    15·1 answer
  • Air flows through a device such that the stagnation pressure is 0.4 MPa, the stagnation temperature is 400°C, and the velocity i
    8·1 answer
  • A large tank is filled to capacity with 500 gallons of pure water. Brine containing 2 pounds of salt per gallon is pumped into t
    15·1 answer
  • If the car passes point A with a speed of 20 m&gt;s and begins to increase its speed at a constant rate of at = 0.5 m&gt;s 2 , d
    11·1 answer
  • B1) 20 pts. The thickness of each of the two sheets to be resistance spot welded is 3.5 mm. It is desired to form a weld nugget
    8·1 answer
  • The organic acid, ACOOH, reacts reversibly with the alcohol BOH, to form the ester ACOOB according to the stoichiometric equatio
    6·1 answer
  • A reciprocating engine of 750mm stroke runs at 240 rpm. If the length of the connecting rod is 1500mm find the piston speed and
    9·1 answer
  • What did the discovery of the Cumberland Gap mean for exploration? PLEASE HELP ILL GIVE YOU BRAINLEIST!
    15·1 answer
  • 6.) ___________ is a disadvantage of local storage since it can be very expensive.
    5·1 answer
  • A crankcase heater is often used to prevent refrigerant from mixing with compressor oil during periods of:
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!