Professional Documents
Culture Documents
import entity.*;
import java.util.Stack;
System.out.println("Stacksize:" + stack.size());
System.out.println("");
System.out.println("Stack peek \n " + stack.peek().getEmployeeInfo());
System.out.println("");
System.out.println("Peforming pop operation ....");
System.out.println("");
while (!stack.empty()){
Employee e = stack.pop();
System.out.println(e.getEmployeeInfo());
System.out.println("---------------------------------------------------------------
-----");
}
if (stack.empty()){
System.out.println("Stack is empty............");
}
}
}
Department
this.setId(id);
this.setName(name);
}
public Department(){
Employee
this.setId(id);
this.setName(name);
this.setAge(age);
this.setSalary(salary);
this.setDepartment(department);
}
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
}
public void setAge(int age){
this.age = age;
}
public double getSalary(){
return salary;
}
public void setSalary(double salary){
this.salary = salary;
}
public Department getDepartment(){
return department;
}
public void setDepartment(Department department){
this.department = department;
}
public String getEmployeeInfo(){
return "Employee Id:" + id + "\nName" + name + "\nAge:" + age +
"\nSalary:" + salary + "\nDepartment:" + department.getName();
}
}