Skip to content

The error in the program was in the TwoLiter class in the add method.#17

Open
LittleJC3 wants to merge 1 commit intonicomp42:masterfrom
LittleJC3:master
Open

The error in the program was in the TwoLiter class in the add method.#17
LittleJC3 wants to merge 1 commit intonicomp42:masterfrom
LittleJC3:master

Conversation

@LittleJC3
Copy link
Copy Markdown

Because it is a stack, it works as last in first out, and Dr. Pepper was
the the last object put into the stack. However, in the method, there
was a a -1 after the UPCs.length and flavors.length eg (UPCs.length -1)
Because of this, the loop was basically going through the all of the
array, except the last thing put in which was the Dr. Pepper, because of
the (UPCs.length-1) and (flavors.length -1)

Because it is a stack, it works as last in first out, and Dr. Pepper was
the the last object put into the stack. However, in the method, there
was a a -1 after the UPCs.length and flavors.length eg (UPCs.length -1)
Because of this, the loop was basically going through the all of the
array, except the last thing put in which was the Dr. Pepper, because of
the (UPCs.length-1) and (flavors.length -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant