Skip to main content

Java counter problem, how do i make the counter grow its stuck at 1?

No replies
shong
Offline
Joined: 2009-08-17
Points: 0

public class EmpList
{
private Employee head;

private Employee tail;

private int count=0;

public void append(Employee e)
{
count++;
e.next = null;

if (head == null)
{
head = e;

tail = e;
}
else
{
tail.next = e;

tail = e;
}
}

public void display()
{

System.out.println("NAME\tSTAFF ID\tDEPT\tRATE\tHOURS WORKED\tSALARY");
System.out.println("--------------------------------------------------------------");
for (int i=1; i <=count; i++)
{
head.display();
System.out.println("count is : " + count);
head = head.next;
}
}
}