Question: How to code with returning true and false: Lets say only 10 items are available in the array public booleanadd(GroceryItemOrder item) If there is space

How to code with returning true and false: Lets say only 10 items are available in the array

public booleanadd(GroceryItemOrder item)

If there is space available in the array then this will add the GroceryItemOrder parameter to the next available space in the array inside this GroceryList object and return true.

If the array is already full then this will leave the array unchanged and return false.

Note: there are no methods to remove items from the GroceryList, so once an item has been added then it's permanently part of the list.

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 Programming Questions!