import static java.lang.Math.*;
public class EmployeeProject3
{
public static void main(String[] args)
{
// construct a Manager object
Executive A = new Executive("Executive", 300, 7, 3);
Manager B = new Manager("Manager", 400, 7, 0);
Employee[] staff = new Employee[7];
// fill the staff array with Manager and Employee objects
staff[0] = A;
staff[1] = B;
staff[2] = new Employee("Employee", 500, 7, 0);
staff[3] = new Employee("Employee", 500, 7, 0);
staff[4] = new Employee("Employee", 500, 7, 0);
staff[5] = new Employee("Employee", 500, 7, 0);
staff[6] = new Employee("Employee", 500, 7, 0);
// print out information about all Employee objects
for (Employee e : staff)
{
System.out.println("Type: " + e.getName() + "\t Basic Salary|" + e.getBasic_Salary()
+ "\t Height|" + e.getHeight() + "\t Radius|" + e.getRadius()
+ "\t Bonus|" + e.getBonus()+"\t Total|" + e.getTotal());
}
}
}
class Employee
{
private String name;
private double basic_salary, total, radius, height;
public Employee(String n, double s, double r, double h)
{
name = n;
basic_salary= s;
radius = r;
height = h;
}
public String getName()
{
return name;
}
public double getBasic_Salary()
{
return basic_salary;
}
public double getRadius()
{
return radius;
}
public double getHeight()
{
return height;
}
public double getBonus()
{
double bonus=2*PI*radius;
return Math.floor(bonus);
}
public double getTotal()
{
total=basic_salary+this.getBonus();
return total;
}
}
class Manager extends Employee
{
public Manager(String n, double s, double r, double h)
{
super(n, s, r, h);
}
public double getBonus()
{
double bonus=PI*pow (getRadius(),2);
return Math.floor(bonus);
}
}
class Executive extends Manager
{
public Executive (String n, double s, double r, double h)
{
super(n, s, r, h);
}
public double getBonus()
{
double bonus=PI*pow (getRadius(),2)*getHeight();
return Math.floor(bonus);
}
}