2 Encapsulation and constructor chaining
-
If needed, retrieve the OOP Company project up to chapter 1 from DLO. It contains the
ProgramandPersonclasses as you left them at the end of chapter 1. -
Change the
Personclass according to the class diagram below:a) Add the constant
BonusThreshold.
b) Make the four non-static attributes private.
c) Add properties for these four attributes (properties are not shown in the class diagram).
d) Apply constructor chaining to the three constructors.
e) Add theHasRightToBonus()method. It returnstrueif the monthly salary is greater than or equal toBonusThreshold. -
Fix any errors that have arisen in your
Mainmethod (access the attributes via their properties). -
Remove the last two lines of code (both starting with
Console.WriteLine) and add code so that your output looks like this:1 2 3 4 5 6 7 8
0 1 1 2 2 4 Mark earns 10000,00 and has right to a bonus. Caroline earns 4000,00 and has no right to a bonus.