// poly_arrays2
class Employee {
    public static final int BASE = 10000;
    protected String name;
    protected double salary;
    protected double rank = 1;
    public Employee(String name) { this.name=name; }
    protected void setSalary() { salary = BASE*rank; }
    public double getSalary()  { return salary; }
    public static double totalPay(Employee[] e) {
	double total = 0;
	for(int i = 0; i < e.length; i++)
	    total += e[i].getSalary();
	return total;
    }
}
class Pion extends Employee {
    public Pion(String name, int rank) {
	super(name);
	this.rank=rank;
	setSalary();
    }
}
class Boss extends Employee {
    public Boss(String name, int rank) {
	super(name);
	this.rank=rank;
	setSalary();
    }
    protected void setSalary() {
	salary = 10*BASE*rank;
    }
}
public class poly_arrays2 {
    public static void main(String[] args) {
	Employee[] e = 	{ 
	    new Pion("E1",1),
	    new Pion("E2",2),
	    new Boss("B1",1)
		};
	System.out.println(Employee.totalPay(e));
    }
} // output: 130000.0
