← Back to Classes
Question 203
Payroll System with Abstract and Interface
Payroll System with Abstract and Interface
Build a small payroll system. 1. Create an interfacePayablewith a methoddouble pay(). 2. Create an abstract classStaffthat implementsPayable. It has aprotected String namefield and a constructor. It does NOT implementpay()— subclasses must. 3. CreateFullTimeStaffextendingStaff. Constructor takesnameanddouble monthlySalary.pay()returnsmonthlySalary. 4. CreateContractStaffextendingStaff. Constructor takesname,double hourlyRate, andint hours.pay()returnshourlyRate * hours. Do NOT write a main method.
Expected Output:
Alice: 5000.00 Bob: 3200.00
Topics:
Abstract ClassesInterfacesClasses
Code Editor
1
Tab to indent · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.