add method in arrays
I am having problem making a Grocery List.
At First I wanted to use an Array, though I ran into problem with the addd and remove command so I decided to use the Vector class.
I would love to use the array, if any one has an algorithm that works just like the one in the vector class that would be useful. Or Better yet tell me why this alogrith has a fault...
static int index;
GroceryItemOrder items; //Array of the item Object
//The add method
public void add(GroceryItemOrder item)
//if there are no items already
}else // if there are, save in next slot
items[index + 1] = item;
//for the remove method I just decided to set the value to be removed to null.
I got the problem.. it works fine now though i am having a bit of a problem again..