Question: Java - Polymorphism, instanceof, object orientated prgoramming thanks! Write Java code to implement the following design: a) AFirm class has a main method that creates
Java - Polymorphism, instanceof, object orientated prgoramming
thanks!
Write Java code to implement the following design: a) AFirm class has a main method that creates a Staff object and tests its methods b) A Staff class has an array of the type StaffMember with six elements: A method payday ( ) which has a loop that runs over the StaffMember array. Inside the loop, you should call the pay () method for each array element that is not a Volunteer (Hint: use instanceof). i. ii. 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 toString) double pay StaffMemberl void payday) String SIN, double payRate Volunteer Employee String toString0 double pay Executive double bonus void awardBonus(double bonus) String toString() double pay) Hourly int hoursWorked 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
