CJCoding With Joseph
15free / daySign inCreate account

Build a payroll hierarchy from scratch. Define an abstract class Employee with an abstract method int WeeklyPay(). Then define two subclasses: - HourlyEmployee(int rate, int hours) whose pay is rate * hours - SalariedEmployee(int annualSalary) whose weekly pay is annualSalary / 52 The tester stores them in a List<Employee> and totals the weekly pay. Do NOT write a Main method.

For HourlyEmployee(20, 40) (pay 800) and SalariedEmployee(52000) (weekly 1000) the program prints the output shown in Expected Output.

Expected output

1800

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Polymorphism
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.