Students, please be sure to log in. This site does not use cookies and does not track/store work submitted when not signed in.
Unit 7 Problems
Java Reference Sheet
sum67
Objective: Write program code to create, traverse, and manipulate elements in 1D array or ArrayList objects.
Complete the method sum67, which returns the sum of the numbers in the list, except ignore sections of numbers starting with a 6 and extending to the next 7 (every 6 will be followed by at least one 7). Return 0 for no numbers.
sum67([1, 2, 2]) -> 5
sum67([1, 2, 2, 6, 99, 99, 7]) -> 5
sum67([1, 1, 6, 7, 2]) -> 4
The following are methods of a list that can be used to manipulate the contained data.