1 import java.util.Scanner;
2
3 public class SalaryDemo
4 {
5 public static void main(String[] args)
6 {
7 Employee[] staff = new Employee[3];
8 staff[0] = new HourlyEmployee("Morgan, Harry", 30);
9 staff[1] = new SalariedEmployee("Lin, Sally", 52000);
10 staff[2] = new Manager("Smith, Mary", 104000, 50);
11
12 Scanner in = new Scanner(System.in);
13 for (Employee e : staff)
14 {
15 System.out.print("Hours worked by " + e.getName() + ": ");
16 int hours = in.nextInt();
17 System.out.println("Salary: " + e.weeklyPay(hours));
18 }
19 }
20 }