Difference between aggregation and inheritance

Assignment Help C/C++ Programming
Reference no: EM13939989

a) Describe the difference between aggregation and inheritance in object-oriented programming.

b) A class called Employee has attributes for the name of the person and his/her salary, together with methods for accessing the attributes and methods for setting the attributes. A class SalesPerson is inherited from class Employee (described above), and has an attribute representing a bonus. It also has methods for accessing and setting the attribute bonus.

i) Write a parameterised constructor for class SalesPerson which receives values for name, salary and bonus.
ii) Provide an explanation of how the salary attribute in class Employee has been set.
iii) Explain the difference between this and super when these words are used as the names of objects that are called in a constructor definition.

c) Describe, with the aid of diagrams, how you would design programs to implement the following problems. Identify the classes, attributes and the relationships between them.

i) A bicycle has two wheels and a set of gears. Wheels are available in different sizes. The gear mechanism can have 18 or 24 gears.

ii) A car has an engine, two or four seats and is available as a saloon or cabriolet model. A lorry has an engine, eight wheels and a capacity to carry up to a specified weight.

Reference no: EM13939989

Questions Cloud

Stored in the array points before line seven : Questions (i) to (vii) relate to the following code. A class called Point is defined and the code fragments that are called from main() are given line numbers 1 to 7.
How has hiv affected the population distribution in africa : How has HIV/AIDS affected the population distribution in Africa (especially Southern Africa)? What social processes have driven such high rates of the epidemic and how might the spread of HIV/AIDS be contained in this area of the world
Calculate a plantwide rate for xanning company : Calculate a plantwide rate for Xanning Company based on machine hours. What is the bid price of each job using this rate?
Highest population densities in canada : Fertile soil laid down at the conclusion of the Pleistocene Ice Age by wind is called: and The highest population densities in Canada are found in
Difference between aggregation and inheritance : A class called Employee has attributes for the name of the person and his/her salary, together with methods for accessing the attributes and methods for setting the attributes. A class SalesPerson is inherited from class Employee (described above)..
Construct a simple blueprint for one service process : Construct a simple blueprint for one service process in your organisation. Identify and discuss the critical points within the service delivery process that are likely to have a significant bearing on the customer's experience.
Prepare job-order cost sheets for the given two jobs : Prepare job-order cost sheets for the two jobs, showing total cost. Which cost do you think is more likely to be accurate? How might Steve build in some of the uncertainty of Ed's job into a budgeted cost?
Provide a brief overview of strategies : What other strategies would be a good fit for your company profile and provide a brief overview of these strategies
Business by accurately identifying needs of different guests : A discussion of how front office can add value to the business by accurately identifying the needs of different guests by market

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Customer details file in the configuration file

Display a message to the user to specify the path of the file in which the customer details are to be stored. Create the customer details file at the user-defined location. Create a configuration file and store the path of the customer details file i..

  Write a program to print the permutation

Write a program to print the permutation that lexicographically precedes the given input permutation.

  Why the native operator will not work with classes

Why the native operator will not work with classes unless they have been properly overloaded

  Write a c program to enter the numbers until the user wants

Write a C program to enter the numbers until the user wants and in the end display the product of numbers entered by the user.

  How compiler determine when 2 functions have same name

When two or more functions have the same name, how does the compiler determine which one to use for a particular function call?

  Accept positive and negative numbers in its input sequence

the program must accept positive and negative numbers in its input sequence, and ?nd the largest and smallestof the numbers entered whether they are all positive, all negative, or a combination of both positive and negative.

  Writing function that computes leap years

Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.

  Called cbankaccount

Create a base class, called CBankAccount, and two additional classes (each derived from CBankAccount), called CSavingsAccount and CCheckingAccount.

  Explain how priority queue list works

Hi. I have done a priority queue list. We have been giving test code to test our list. I will post what I have along with the issues. I keep getting an error with the getelement() part in the main program where we are supposed to print out the ele..

  Need a program that has the user enter a string

Need a program that has the user enter a string. The program will test to see if its a exact palindrome like "civic" or "level". then it should test if its an inexact palindrome like "a nut for a jar of tuna".

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Compute the average of each row

Write a program that prompts the user to enter 15 double numbers from the keyboard and save them into a 3 by 5 array in the main ( ). Then call a user-define function to compute the average of each row and print the original matrix and average of ..

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