Question: Q3. Write Java code to implement the following design: a) A Firm class has a main method that creates a Staff object and tests its

Q3. Write Java code to implement the following design: a) A Firm class has a main method that creates a Staff object and tests its methods b) A Staff class has i. an array of the type StaffMember with six elements: . ii. A method payday ( ) which has a loop that runs over the Staf fMember array. Inside the loop, you should call the pay) method for each array element that is not a Volunteer (Hint: use instanceof) c) For all other classes, you only need to write dummy methods (i.e. no code for method bodies Methods here are used solely for testing purpose) Firm main String name, address, phone Staff StaffMember String toString0 double pay StaffMemberll void payday0) String SIN, double payRate Volunteer Employee String toString() double pay( Executive double bonus void awardBonus(double bonus) String toString() double pay Hourly int hours Worked void addHours(int moreHours) String toString() double pay)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
