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
sum13
Objective: Write program code to create, traverse, and manipulate elements in 1D array or ArrayList objects.
Complete the method sum13, which returns the sum of the numbers in the list, returning 0 for an empty array. Except the number 13 is very unlucky, so it does not count, and numbers that come immediately after a 13 also do not count.
sum13([1, 2, 2, 1])->6
sum13([1, 1])->2
sum13([1, 2, 2, 1, 13])->6
The following are methods of a list that can be used to manipulate the contained data.