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

  Create a program in java that displays hello world

Create a program in Java that displays "Hello world!" Take a screen shot that shows the program's successful compilation and execution

  Create a console program that prompts the user

Create a console program that prompts the user to enter the name and address of their employer and position they hold or the name and address of their favorite restaurant and their favorite meal

  Create a java program to calculate

Create a Java Program to calculate the all grades inputted by a student, the average grade for the student, the letter grade for the student, and the valid inputted scores displayed in ascending order.

  Write methods to retrieve information about a note

calculate the frequency, use the formula 440 x 2^(n/12) where n is the note number - implement a class that will be used to hold information about a musical note.

  This applet program needs an html file to run.

This applet program needs an html file to run. You should supply the file along with the program so that the reader can test it.

  Create an application for kochs cottages

Create an application for Koch's Cottages, a weekend getaway resort that rents boats and cottages to use on the local lake.

  Create an application that uses a graphic interface

Create an application that uses a graphic interface to capture room assignment data for dormitory residents and writes that data to a random access output file.

  Using notepad that implements a basic text analyzer

Write a Java application using Notepad that implements a basic Text Analyzer.

  Write a program that will prompt the user for a file name

Write a program that will prompt the user for a file name and open that file for reading. Print out all the information in the file, numbering each new line of text.

  Write a java application using netbeans ide

Write a Java application using NetBeans Integrated Development Environment (IDE) or jGROUP IDE that calculates the total annual compensation of a salesperson

  How control constructs and arrays would resolve problem

Arrays and control structures are valuable tools when programming. An array contains a number of variables all being the same data type. Explained the situation and how control constructs and arrays would resolve problem

  What are mobile oss you have personally used explain the

write a 200- to 300-word short-answer response to the following bull what are mobile oss you have personally used?

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