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
Turn on your____
storchak [24]

Answer:

b

Explanation:

5 0
3 years ago
Read 2 more answers
1). Mention any four operations that requires airlines. 2). Explain how airflow is applicable to the above mentioned operations.
vladimir2022 [97]

Answer:

Following are the answer to this question:

Explanation:

1)

Following the four operations in the airlines:

Landside operations:

In Airlines, the airports are divided into areas on the countryside and on the airside, in which landside region is available to the public, although strictly controlled access to the airside zone. Its area covers all areas of the airport across the aircraft, including parts of the buildings which can only be reached by customers and employees.

Airside Operations:

It's also committed to ensuring which air operations military exercises Ballarat airfields are safe and secure. It includes the provision of parking and flight escort services to itinerant and automates. Organizing operational response to incidents, accidents, or emergencies at the airport.

Billing and invoicing Operations:

This requires several steps, each of which must be performed with absolute accuracy to ensure that perhaps the airport operator is adequately paid for supplying passengers with all the services and infrastructure. After this, the receipts want to be produced and sent to customers on the airline.

Information management:

In this, it collects all the data about the customers and employees and it also helps in finding new routes and after collecting the data it processes on them.  

2)

It involves many activities in the airline, including dispatch, flight preparation, flight watch, weather information source, activities control, ground-to-air communications, and staff coordination, scheduling, and maintenance planning. Computing and expert programs are constantly being used to handle unpredictable activities.

4 0
3 years ago
If you get a flat in the front of your car, your car will:
juin [17]

Answer:

stop and might even crash

Explanation:

6 0
3 years ago
"At 195 miles long, and with 7,325 miles of coastline, the Chesapeake Bay is the largest and most complex estuary in the United
Paraphin [41]

Answer:

see explaination

Explanation:

Part a) Width of bay at Potomac River:

Given Data:

· Actual Width at Potomac River = 30 miles

· Bay Model Length Ratio Lr = 1/1000

In fluid mechanics models of real structures are prepared in simulation so that they can be analyzed accurately. A model is known to have simulation if model carries same geometric, kinematic and dynamic properties at a small scale.

Length of any part in model = Actual length x Lr

Hence,

Model Width of bay at Potomac River = 30 x 1/1000 = 0.03 miles

Since 1 mile = 5280 ft

Model Width of bay at Potomac River = 0.03 x 5280 = 158.4 ft

Part b) Model Length of bay bridge in model:

Given Data:

· Actual Length of bay bridge = 4.3 miles

· Bay Model Length Ratio Lr = 1/1000

Model Length = Actual Length x Lr = 4.3 x 1/1000 = 0.0043 miles

Since 1 mile = 5280 ft

Model Length in feet = 0.0043 x 5280 = 22.704 ft

Part c) Model Length of bay bridge in model:

Given Data:

· Model Area = 8 acre

· Bay Model Length Ratio Lr = 1/1000

Model Area = Actual Area x Lr x Lr

8 Model Area :: Actual Area =- (Lp)2 2 = 8,000,000 acre 1000

Since 1 square mile = 640 acre,

Actual Area in square miles = 8,000,000/640 = 12,500 square miles

Part d) Average and maximum depth of model:

Given Data:

· Actual Average depth = 28 ft

· Actual Maximum depth = 174 ft

· Bay Model Length Ratio Lr = 1/1000

Model average depth = Actual average depth x Lr = 28 x 1/1000 = 0.028 feet

Since 1 ft = 12 inch

Model average depth in inch = 0.028 x 12 = 0.336 in

Model maximum depth = Actual maximum depth x Lr = 174 x 1/1000 = 0.174 feet

Since 1 ft = 12 inch

Model maximum depth in inch = 0.174 x 12 = 2.088 in

4 0
3 years ago
Based on these statements:
Evgen [1.6K]

Answer:

the third statement is true

Explanation:

given data

Lenovos cost more than Dells

Lenovos cost less than Apples

solution

we have given 1st statement that is express as

cost (Lenovo) > cost (Dell)     ..................1

and

2nd statement that is express as

cost (Lenovo) < cost (Apple)

so we can say it as

cost (Apple) > cost (Lenovo)       ......................2

and

now above Both equation 1 and 2 can be written as

cost (Apple) > cost (Lenovo) > cost (Dell)      .........................3

so we can say cost of Apples is more than the cost of Lenovos and the cost of Dells

so as that given 3rd statement is true

7 0
3 years ago
Other questions:
  • Practicing new things strains your brain fibers, weakening your ability to make connections.
    13·1 answer
  • Hot water at an average temperature of 88°C and an average velocity of 0.4 m/s is flowing through a 5-m section of a thin-walled
    5·1 answer
  • The y-component of velocity for a certain 2-D flow field is given as u = 3xy + x2 . Determine the x-component of velocity if the
    12·1 answer
  • Which of the following describes fibers? a)- Single crystals with extremely large length-to-diameter ratios. b)- Polycrystalline
    10·1 answer
  • A 3-phase induction motor with 4 poles is being driven at 45 Hz and is running in its normal operating range. When connected to
    12·1 answer
  • A rigid tank contains 5 kg of saturated vapor steam at 100°C. The steam is cooled to the ambient temperature of 25°C. (a) Sketch
    5·1 answer
  • Basic output with variables (Java) This zyLab activity is intended for students to prepare for a larger programming assignment.
    7·1 answer
  • When trying to solve a frame problem it will typically be necessary to draw many free body diagrams. a)-True b)-False
    6·1 answer
  • Why it is important to prepare first the materials and tools carpentry before doing the tasks?​
    6·2 answers
  • Air is compressed isothermally from 13 psia and 55°F to 80 psia in a reversible steady-flow device. Calculate the work required,
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!