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++.
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?
|