id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > sunFunNum
prev  |  next  |  chance

Write a recursive method that returns a string for the sumFunNum of an integer. The sumFunNum of a number is found through a strange little process. If the number is divisible by 3 or 5, we add the word "Sun" to a string and then recursively continue with the one's place removed from the number. Otherwise we add the word "Fun" to a string and then recursively continue with the one's place reduced by one. The original number will be positive, and the recursive process will continue as long as you still have a postivie number. Your solution MUST be recursive. No loops of any kind are allowed!!!


sunFunNum(454788) → "SunFunSunFunFunSunFunSunSunFunSun"
sunFunNum(2353) → "FunSunSunFunFunSunFunFun"
sunFunNum(2134) → "FunSunSunSunFunFun"

...Save, Compile, Run (ctrl-enter)

public String sunFunNum(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 430

Copyright Nick Parlante 2017 - privacy