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.