Java interfaces and multiple inheritance

Assignment Help JAVA Programming
Reference no: EM13963530

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: EM13963530

Questions Cloud

What processing should be done on the computer to recover : A strap, instrumented to measure stretch, is worn around the chest to detect respiration whilst a subject is at-rest. The resulting signal is contaminated by electrical noise from the mains at 50 Hz with a similar amplitude to the respiration sign..
Underlying assumptions of accounting includes : underlying assumptions of accounting includes
Write a critical analysis for each of the given case study : Write a critical analysis for each case study (I need Critical analysis for Case Study 1 and Case study 2).
Choose a topic in managerial economics : Research or Interview Paper Instructions A research paper Steps for writing the research paper: Choose a topic in managerial economics.
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.
Where does your target market fit in the fashion cycle : The next step in developing a promotion campaign is to understand who your customer is. Conduct research and prepare a report describing your target market in terms of: Where does your target market fit in the fashion cycle
What is the equation for the shm at arbitrary position x : The SHM of the left-hand end of a long string is given by y = 1.44 cm * sin ( ( 6 `pi rad/s) t ). This motion induces a traveling wave in the string. The string has tension 13 Newtons and mass per unit length is 14 grams / meter. What is the equat..
The demand for bikers : 1) skateboards become more expensive. the demand for bikers, a substitute good, will A. Rise B. Remain the same C. Fall
The horizontal access : The graph of total costs will have what on the horizontal access?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Default constructor for the chatioexception class.

The second constructor takes in a string as a parameter and passes this string into the call to super();

  Write the specification for the adt as a java interface

Write the specification for the ADT as a Java interface

  Part a -code comprehensionusing the uncommented sample code

part a -code comprehensionusing the uncommented sample code has been provided in moodleanswer the following questions1.

  Using a linked implementation of graph write a method

Write a method that takes two nodes as input and returns true if joining an edge between these two nodes, forms a duplicate path to one of the input nodes within the graph.

  Create a guessing game

Create a guessing game where the user enters an integer between 1 and 10.

  Write a program to recognise the contour of an image

I think there are only small changes to be made, and I would be very grateful if you could show me what to change so that it works properly.

  Discuss key environmental issues facing north america

Discuss the key environmental issues facing North America based on the discussion in the text. Which ones do you see threatening the quality of life in North America the most? Do you have any ideas on how these issues might be addressed?

  Implement a singly linear linked list

Prepare a C++ using visual studios program to implement a singly linear Linked List - You need to implement singly link list in C++.

  Implement client-server communication

Write a java program implementing Client-Server communication using Remote Method Invocation.

  Writing programs for mobile devices with the java language

Discuss considerations in writing programs for mobile devices with the Java language

  Create a deque class based on the discussion of deques

Create a Deque class based on the discussion of deques (double-ended queues) in this chapter. It should include insertLeft(), insertRight(), removeLeft(), removeRight(), isEmpty(), and isFull() methods.

  Complete the classes cipher - caesar and transpose

Complete the classes Cipher, Caesar, and Transpose, and Reverser - Define an interface called Constants that will store the value 26 in the identifier WRAP_AROUND;

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