about | help | code help+videos | done | prefs |
The problem MAY be solved recursively, but recursion is NOT required! This method accepts three doubles named start, mult, and stop. mult will be a positive number not equal to one. If stop is greater than start, mult will be greater than 1, otherwise mult will be between zero and one. The method returns the sum of all the numbers you get along the way from start to stop, multiplying by mult each time with the final answer rounded to the nearest integer. An example will help: Given start=2.0, mult=3.0, stop=27.0; the method should return 26 since 2.0+6.0+18.0=26.0 which rounds to 26. (stop at 18.0 because the next term would be greater than 27.0 which is the stop value). Here is another example: Given start=10.0, mult=0.5, stop=0.3; the method should return 19 since 10.0+5.0+2.5+1.25+0.625=19.375 which rounds to 19. SpringBreakSumDiv(14, 0.5, 0.8) → 27 SpringBreakSumDiv(1, 3, 30) → 40 SpringBreakSumDiv(1, 2, 3) → 3 ...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: 490
Copyright Nick Parlante 2017 - privacy