about | help | code help+videos | done | prefs |
Write a RECURSIVE method that accepts an array of non-negative single-digit integers, and then returns a double that represents those digits as a double parameter. For example, a call the this method that passes in [3,8,0,0,5] would return the double 38005.0. The integer array 'digits' will have at least one integer and each integer will be a 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. If there are leading zeros such as [0,0,0,5,3], the return value does not include those zeros, so in this case a 53.0 would be returned. Notice that the '.0' at the end is because the return type is a double. may12_2017_APSLHL_toNum([3]) → 3.0 may12_2017_APSLHL_toNum([5, 4, 2, 7, 0, 0, 2]) → 5427002.0 may12_2017_APSLHL_toNum([3, 0, 0, 5, 2, 1]) → 300521.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 410
Copyright Nick Parlante 2017 - privacy