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

  Class diagram represents the relationship between parents

Draw a class diagram that represents the relationship between parents, children, and grandparents. Take into account that a person can have both a parent and a child. Annotate associations with roles and multiplicities.

  List various bindings that are needed to determine semantics

List the various bindings that are required to determine the semantics when the statement is executed. For each binding, indicate the binding time used for the language.

  Program should assign a seat in the first class

If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..

  Alter the prototype form page by javascript function

Alter the prototype form page so that when JavaScript function has verified that all the required fields have been filled, cookie is added to user's computer.

  Calculate the total hours of over lapping meetings

Suppose you have a meeting room which can hold multiple meetings and the smalled duration of meeting can be 30 mins. Calculate the total hours of over lapping meetings.

  Extend the java defined hashmap class

Your goal is to extend the java defined HashMap class to add the ability to store multiple objects. To do this, you will edit MultiHashMap.java to both add new methods and override two methods from HashMap.

  Application that accesses and implements a merchant database

iam providing the old Java application files that implement the old Merchant_Database.txt (i.e., Merchant.java, LinkedMap.java, MerchantDatabase.java, Merchant_Database.txt) that allows merchant records to be added, removed, looked up and the resu..

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Can you provide the output of this program

Can you provide the output of this program - What is the output of following JavaScript code?

  Suppose that a variable a is declared as int java eclipse

Suppose that a variable a is declared as int a = 2147483647 (or equivalently,Integer.MAX_VALUE). What do each of the following print. System.out.println(a);

  Class named stock to model a stock

Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.

  Write a java program to store four records

You will handle student records in a file named "student_record". Each record in the file consists of student number of integer type and student name of 32 characters, so the size of each record is 36 bytes. You need to write a Java program to sto..

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