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

  Create java application which creates random phone number

Create and implement Java application which creates and prints a random phone number of the form xxx-xxx-xxxx. Include the dashes in the output.

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Create a simple 2d predator-prey simulation.

The goal for this programming project is to create a simple 2D predator-prey simulation. In this simulation the prey are ants and the predators are doodlebugs. These critters live in a world composed of a 20x20 grid of cells.

  Consider a typical certification hierarchy

Why might Bob still not trust that the certificate for Alice truly establishes Alice as the owner of the public key in the certificate?

  Java programming-gamesystem

JTabbed Panes for GUI Components Part 2: --- Create a JFrame program with a JTabbed pane on it with two panels that mimics a control box for a game system.

  Construct a bulls and cows program for my intro java class

construct a Bulls and Cows program for my intro Java class. This program needs to perform the basic functions of the game (determining how many cows there are and how many bulls there are and tell the player when they win), but it also needs to offer..

  Write a method shift that takes a stack of integers

Write a method shift that takes a stack of integers and an integer n as parameters and that shifts n values from the bottom of the stack to the top of the stack.

  Calculate and display the total retail value of all products

Your application must calculate and display the total retail value of all products sold after all five pairs of inputs are completed - Write a Java application that prompts the user for pairs of inputs of a product number

  Java method for radix sort in binary

java method for radix sort in binary but I want to understand how to do it so please make it as simple as possible

  Program that generates an invoice for a hardware store

You are asked to write a program that generates an invoice for a hardware store.

  Java program to demonstrate the use of jdbc

Write a Java program (non-GUI preferred) to demonstrate the use of JDBC. Write a list of animal and its characteristics to a database using JDBC

  Chat monitoring system

The name of the project is chat monitoring system. in the file you will see the screenshot diagram 2A are my design, You need to upgrade, to look professional like the diagram 2B. Java, netbeans and GUI.

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