Set-Up
For this assignment, you will be working on several mini-projects to demonstrate, and showcase, your recursion knowledge.
The Assignment
Create a class called RecursionFun.java and implement the following methods recursively.
Be sure to include tests in your main method to valid their correctness.
// Print the digits of an integer reversely e.g. (12345 -> 54321)
public static void reverseDisplay(int value)
// Print the characters in a string reversely e.g. "ABC" -> "CBA"
public static void reverseDisplay(String value)
// Returns the number of times the character 'a' exists in the string 'str'
public static int count(String str, char a)
// Returns the value of the first argument raised to the power of the second argument
public static long pow(long a, long b)
// Given a string, compute recursively a new string where identical chars that are adjacent in the original string are separated from each other by a "*"
// pairStar("hello") → "hel*lo"
// pairStar("xxyy") → "x*xy*y"
// pairStar("aaaa") → "a*a*a*a"
public static String pairStar(String str)
Submit the following:
RecursionFun.java with a code comment (Be sure to include tests in your main method to valid their correctness.)
A screenshot of ALL the output
JAVA JAVA Programing To Loop is Human, to Recurse is Divine You will often experience "fractals" and "recursion" uttered in the same breath. A fractal is a never-ending pattern and are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. You can therefore see why they would be good candidates for pairing with recursive functions. If you are interested, you may (optionally) read more about this connection here (https://natureofcode.com/book/chapter-8-fractals/). There is also a very silly, very optional, [NSFW - Language] song (https://www.youtube.com/watch?v=ZDU40eUcTj0) on the topic if you are curious and into goofy math humor. Set-Up For this assignment, you will be working on several mini-projects to demonstrate, and showcase, your recursion knowledge. https://natureofcode.com/book/chapter-8-fractals/ https://natureofcode.com/book/chapter-8-fractals/ https://www.youtube.com/watch?v=ZDU40eUcTj0 The Assignment Create a class called RecursionFun.java and implement the following methods recursively. Be sure to include tests in your main method to valid their correctness. // Print the digits of an integer reversely e.g. (12345 -> 54321) public static void reverseDisplay(int value) // Print the characters in a string reversely e.g. "ABC" -> "CBA" public static void reverseDisplay(String value) // Returns the number of times the character 'a' exists in the string 'str' public static int count(String str, char a) // Returns the value of the first argument raised to the power of the second argument public static long pow(long a, long b) // Given a string, compute recursively a new string where identical chars that are adjacent in the original string are separated from each other by a "*" // pairStar("hello") → "hel*lo" // pairStar("xxyy") → "x*xy*y" // pairStar("aaaa") → "a*a*a*a" public static String pairStar(String str) Submit the following: 1. RecursionFun.java with a code comment (Be sure to include tests in your main method to valid their correctness.) 2. A screenshot of ALL the output