Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the class hierarchy shown in the figure below. The classes represent various tynes of staff that mieht be emoloved at a narticular comnanv. All
Consider the class hierarchy shown in the figure below. The classes represent various tynes of staff that mieht be emoloved at a narticular comnanv. All the nav () methods re a) Write a dava statement to deciare an array, namea as starrList, or type StaffMember, whose elements can be used to refer to the various type of staff objects. Set the array size to be 4 . (2 marks) b) Suppose that all of the elements in the array have been assigned with the appropriate staff objects. The following for loop is used to display the amount to be paid to all of the staff. Fill in the missing parts with the correct Java codes. ( 3 marks) c) Suppose that the first element in the array is assigned with an Executi ve object. The following statement is used to award a bonus of RMS00.00 to the staff but it produces a syntax error: staf fist [0]. awardBonus (500.00); Briefly explain the reason for the error. (2 marks) d) Rewrite the Java statement in (c) above which can resolve the syntax error. (2 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started