insert element into array problem
Hi,
I have problem about how to insert value into an array. here is one section, could anyone help me to insert input value into array and delete the first value in the array.Gap means to fill in code
void Ins(String name)
// Insert name or increment its multiplicity.
// If the bag is full remove the oldest entry.
{
int i;// Running index on BagName
int target;// if target < n then name.equals(BagName[target]);
// else target == n
Date EntryDate;// Current date and time
// Get current date and time
EntryDate = new Date();
BagDate[n] = EntryDate.toString();
Mult[n] = n+1;
BagName[n] = name;
n++;
// Search bag for name
// Gap 2
// Assertion: target < n => name.equals(BagName[target])
//else target == n
// Update Mult if target < n
// Gap 3
// Make room for and insert name if target not found
} // Ins(String name)
Message was edited by:
sibojava
Message was edited by:
sibojava

