Driver program demonstrating dynamic polymorphism using the Employee hierarchy.
@author
@author
@version
public class PayrollDriver {
Entry point for showing polymorphic behavior.
@param args
public static void main(String[] args) {
Employee emp = new Employee("Mario Jumpman", "EMP-101", "2026-01-15", 7.25, 20.0);
Cashier cash = new Cashier("Princess Peach", "CSH-202", "2026-03-01", 10.00, 30.0);
cash.setTillStart(200.00);
cash.setTillEnd(850.50);
Manager mgr = new Manager("Bowser Koopa", "MGR-303", "2026-05-10", 20.00, 45.0, "KEY-GOLD-99", 250.00);
Employee staff;
staff = emp;
System.out.printf("%-15s | Calculated Pay: $%.2f%n", staff.getName(), staff.getPay());
staff = cash;
System.out.printf("%-15s | Calculated Pay: $%.2f%n", staff.getName(), staff.getPay());
staff = mgr;
System.out.printf("%-15s | Calculated Pay: $%.2f%n", staff.getName(), staff.getPay());
}
}