1234567891011121314151617181920212223242526272829303132333435363738394041
  1. public class LoopFun
  2. {
  3. /**
  4. * Given a number, return the factorial of that number.
  5. * For example, given 5, the factorial is 5 x 4 x 3 x 2 x 1 which should return 120.
  6. * @param number
  7. * @return the factorial of the number
  8. */
  9. public int factorial(int number){
  10. return -1;
  11. }
  12. /**
  13. * Given a phrase, get the acronym of that phrase. Acronym is the combination of
  14. * the first character of each word in upper case.
  15. * For example, given "Ruby on Rails", this method will return "ROR"
  16. * @param phrase
  17. * @return Upper case string of the first letter of each word
  18. */
  19. public String acronym(String phrase) {
  20. return null;
  21. }
  22. /**
  23. * To prevent anyone from reading our messages, we can encrypt it so it will only be readable by its
  24. * intended audience. This method encrypt the message by shifting the letter by 3 characters. If the character is
  25. * at the end of the alphabet, it will wraps around.
  26. * For example:
  27. * 'a' => 'd'
  28. * 'w' => 'z'
  29. * 'x' => 'a'
  30. * 'y' => 'b'
  31. * @param word
  32. * @return the encrypted string by shifting each character by three character
  33. */
  34. public String encrypt(String word) {
  35. return null;
  36. }
  37. }