Java interfaces-multiple inheritance

Assignment Help JAVA Programming
Reference no: EM13963549

Java Interfaces and Multiple Inheritance

In C++, a derived class may have multiple base classes. In contrast, a Java derived class may only have one base class but may implement more than one interface. This question asks you to compare these two language designs.

(a) Draw a C++ class hierarchy with multiple inheritance using the following classes:

Pizza, for a class containing all kinds of pizza,

Meat, for pizza that has meat topping,

Vet, for pizza that has vegetable topping, Sausage, for pizza that has sausage topping, Ham, for pizza that has ham topping, Pineapple, for pizza that has pineapple topping,

Mushroom, for pizza that has mushroom topping,

Hawaiian, for pizza that has ham and pineapple topping.

For simplicity, treat sausage and ham as meats and pineapple and mushroom as vegetables.

(b) If you were to implement these classes in C++ for some kind of pizza- manufacturing robot, what kind of potential con?icts associated with multiple inheritance might you have to resolve?

(c) If you were to represent this hierarchy in Java, which would you de?ne as interfaces and which as classes? Write your answer by carefully redrawing your picture, identifying which are classes and which are interfaces. If your program creates objects of each type, you may need to add some additional classes. Include these in your drawing.

(d) Give an advantage of C++ multiple inheritance over Java classes and interfaces and one advantage of the Java design over C++.

Reference no: EM13963549

Questions Cloud

Smith-kline company maintains inventory : Smith-Kline Company maintains inventory records at selling prices as well as at cost.
What is the tension in the support cable : A certain steam engine has an output of 500 hp and its efficiency in the use of fuel is 14%. It burns fuel oil that has a heat of combustion of 10,000 cal/g. How many kg of oil does the engine consume each hour?
Problem regarding the java bytecode analysis : One property of a Java program that is checked by the veri?er is that each object must be properly initialized before it is used. This property is fairly dif?cult to check. One relatively simple part of the analysis, however, is to guarantee that ..
The amount of the average investment for a proposed : The amount of the average investment for a proposed investment of $120,000 in a fixed asset with a useful life of 4 years, straight-line depreciation
Java interfaces-multiple inheritance : In C++, a derived class may have multiple base classes. In contrast, a Java derived class may only have one base class but may implement more than one interface. This question asks you to compare these two language designs.
A complete physical inventory : A complete physical inventory taken at year-end indicates only 50 units of this product actually are on hand
Find perturbation to energy of lowest-energy singlet state : Suppose that the particles interact weakly by the potential V_1(x)=Kdelta(x_1 - x_2), where x_1 and x_2 are the positions of the two particles , K is a constant, and delta is the Dirac delta function. This represents a very short-range weak force ..
Find the temperature of the steam serving : I know the efficiency of Carnot engine is 1- (T_c/T_h) and the thermal efficiency of a heat engine is 1- (Q_c/Q_h). I'm not sure how to set this up
What is the probability that the particle will be found : There are some excited states n in which the particle will never be found, no matter what values are chosen for t_1 and t_2. Which excited states are these?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a java declaration for one real number quantity

Write a single Java statement to declare two integer quantities called orderOne and orderTwo, each initialized to 0.

  Discuss the pros and cons of compilers and interpreter

Pick a problematic situation that you think a Java program can solve or make easier.

  Identifing the appropriate class names, attributes & methods

I am having problems identifing the appropriate class names, attributes and methods for the following objects. I need at least 3 attributes and 3 methods for each class.

  Case study - greenhouse humidity control

The control system that will respond to sensor information to turn on/off a misting device, turn on/off a watering system and open/close ventilation windows.

  Processing file data in java

Purpose: This assignment will provide more practice in processing file data in Java.  It will also require the declaration of a class type, the creation of a list of objects, and some simple processing of the list that will involve sorting and com..

  What is an advantage of executing a process in background

What is an advantage of executing a process in background? How do you execute one program from within another?

  Can we run java byte code on android since android

Can we run java byte code on android since android is also java based

  Display the value stored at the index

Display the value stored at the index. Take a screenshot to verify that the words in your Array or ArrayList are displayed successfully.

  Eax contains the given contents before the instruction

For each add instruction in this problem, assume that EAX contains the given contents before the instruction is executed, and give the contents of EAX as well as the values of the CF, OF, SF, and ZF flags after the instruction is executed:

  Create a class to encapsulate the data and behavior

Create a class to encapsulate the data and behavior of a product in a store's inventory. The class should have the following data for an inventory item

  General readability and understandability of java code

I need assistance in remarking the enclosed Java Code high-lighting, things like code layout, use of variable names, general readability and understandability.

  Calculates and displays the mortgage payment amount

Write a Java program without a graphical user interface that calculates and displays the mortgage payment amount given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. In this program, hard code the amou..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd