BoraluGoda

Member
Jan 28, 2011
486
114
0
::: GiRiPuRa :::
I have java codes, please anyone can help me to build a interface for get PEEK and PUSH using those java class ??

Code:
	public void push(Employee x){

		stackArray[++top] = x;
	}

	public Employee peek(){
	
		return stackArray[top];
	}

	public Employee pop(){
		return stackArray[top--];
	}

	public boolean isEmpty(){

		return (top == -1);
	}

	public boolean isFull(){
		return (top == maxSize-1);
	}
   
}



Code:
public class Employee{

	private int empID;
	private String empName;
	private double salary;

	
	public Employee(int empID, String empName, double salary) {
        this.empID = empID;
        this.empName = empName;
        this.salary = salary;

    	}


	public int getEmpID() {
        return empID;
    	}

    	public String getEmpName() {
        return empName;
    	}

    	public double getSalary() {
        return salary;
    	}


}
 

rcccc

Member
Aug 19, 2011
50,117
2,571
0
36
-Goodbye-
bump.gif
 

DJvodka

Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    I have java codes, please anyone can help me to build a interface for get PEEK and PUSH using those java class ??

    Code:
    	public void push(Employee x){
    
    		stackArray[++top] = x;
    	}
    
    	public Employee peek(){
    	
    		return stackArray[top];
    	}
    
    	public Employee pop(){
    		return stackArray[top--];
    	}
    
    	public boolean isEmpty(){
    
    		return (top == -1);
    	}
    
    	public boolean isFull(){
    		return (top == maxSize-1);
    	}
       
    }



    Code:
    public class Employee{
    
    	private int empID;
    	private String empName;
    	private double salary;
    
    	
    	public Employee(int empID, String empName, double salary) {
            this.empID = empID;
            this.empName = empName;
            this.salary = salary;
    
        	}
    
    
    	public int getEmpID() {
            return empID;
        	}
    
        	public String getEmpName() {
            return empName;
        	}
    
        	public double getSalary() {
            return salary;
        	}
    
    
    }
    If you could elaborate on what you want to do more clearly, I might be able to help