removeSevens
Objective: Write program code to create, traverse, and manipulate elements in 1D array or ArrayList objects.
Complete the method removeSevens
that takes a list and removes all the 7s from it.
ie. a call to removeSevens
on a list, [1 2 7 7 7 8]
results in a new list [1 2 8]
Pre-condition: a non-empty list (what you know before the body of the method runs)
Post-condition: elements that are not 7s appear in the same order they were in the list (What is true after the method runs?)
Hint: You might naturally traverse the list from the front, but what is the benefit of traversing the list from the back in this problem?
The following are methods of a list that can be used to manipulate the contained data.
Type your solution
Skills Practiced:
3.C
3.D
4.A
4.B
Saved
Saved