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

  Write program that takes number show number in power of 3

Write a program that takes a number between -121 and 121 and output that number in the format of power of 3 (1,3,9,27)

  Public transport fare ticketing system

Implement and test a public transport fare ticketing system.

  Monkey business, a local zoo

Monkey Business, a local zoo, wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 7 array, where each row represents a di..

  Program for compiler design in c

Write a Program for compiler design in c.

  Program reads in and prints three bowling scores

The main program reads in and prints three bowling scores, score1, score2, and score3. It then calls a series of functions to process these scores.

  Program to check compatibity for matrix multiplication

Write down program in C++ for matrix multiplication. Program must accept dimension of both matrices to be multiplied and check for compatibity.

  1 recursive sorts are easier to write in functional style

1 recursive sorts are easier to write in functional style than others. two recursive sorts are quicksort and mergesort.

  Write a switch statement that assigns a string variable

Write a switch statement that assigns a String variable monthName with the months January, February, March, April, May, and June, ifmonthNum is 1, 2, 3, 4, 5, 6, accordingly.

  Create constructor function which takes no inputs

You must have the constructor function which takes no inputs and randomly generates the 5 letter string for name and random integers from 20 to 40 for both age and class size.

  Write a program that ask a user to enter a list of names

Write a program that ask a user to enter a list of names. When you finish, The program will show the total number of characters in all the names.

  Create a program that asks the user to enter in two numbers

Create a program that asks the user to enter in two numbers. Pass the two numbers as arguments to a function. If the sum of the numbers is greater than 10, the function returns true. Otherwise the function returns false

  Program that asks the user to enter the number of miles

Write a C - program that asks the user to enter the number of miles traveled and the number of gallons of gasoline consumed. It should then calculate and display the miles-per-gallon value. Confine your output to 1 decimal place.

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