Question: +toStringAscending() : String This returns a String representation of the bag with the values in ascending order public static boolean toStringAscending() { boolean b =

+toStringAscending() : String

This returns a String representation of the bag with the values in ascending order

public static boolean toStringAscending() { boolean b = true; for (int i = 0; i < container.length; i++) {

for (int j = i + 1; j < container.length; j++) {

int temp = 0; if (container[j] < container[i]) {

temp = container[i]; container[i] = container[j]; container[j] = temp; } } } return b;

}

+delete(item: Item) : boolean

This deletes from the bag one occurrence of item and returns true if the deletion was made

+deleteAll(item:Item) : boolean

This deletes from the bag all of the occurrences of item and returns true if any deletions were made

public boolean delete(int item) { int index = indexOf(item);

for (int i = 0; i < 0; i++) { if (container[i] == item) {

container[i] = container[slot--];

return true;

}

}

return true; }

ublic boolean deleteAll(int item) {

boolean b = false;

for (int i = 0; i < this.size(); i++) {

if (container[i] == item) {

for (int j = i; j < container.length - 1; j++)

container[j] = container[j + 1];

slot--;

b = true;

}

}

return b;

} // need help on fixing some issue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!