rendered paste bodypublic class Store
{
// Private Data
private Person[] list;
private int count;
private int maxSize;
private int current = 0;
// constructor
public Store(int max)
{
maxSize = max;
list = new Person[maxSize];
count = 0;
}
// transformer
public void add(Person p)
{
list[count] = p;
count ++;
}
public void incrementPointer()
{
if(maxSize == current)
current = 0;
}
//accessors
public boolean isFull()
{
return count == maxSize;
}
public int getCount()
{
return count;
}
public Person currentRecord()
{
return p[current].name;
}
public boolean isIn(Person p)
{
boolean found = false;
int counter = 0;
while ( counter < count & ! found)
{
if (list[counter].equals(p))
found = true;
counter ++;
}
return found;
}
//output method
public void displayAll()
{
for (int counter= 0; counter< count; counter ++)
System.out.println(list[counter]);
}
}