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