Arrowhead Curve get Prod public class ArrowheadCurve Given the character, return
ID: 3834358 • Letter: A
Question
Arrowhead Curve get Prod public class ArrowheadCurve Given the character, return the appropriate production for that character. Implements the Sierpinski Arrowhead Curve refer to https://en. Wikipedia.org/wiki/L-system Example 5 Sierpinski triangle (make sure to scroll down to the part about the Sierpinski Arrovhead Curve) eparam c the character to expand eretum the appropriate production for the given character. public static String get Prod char c) TODO: replace with your inplementation Scanner reader new Scanner System.in) reader next charAt (0) return "c"; end get Prod Given the String representing the current generation, return a new String that is the result of applying the get Prod rules to each character in the current generation. eparam curGen a String that is the current generation ereturn a new String that is the result of applying the get Prod rules to each character in the current generation. public static String nextGen (String curGen) TODO: replace with your inplementation return end nextGenExplanation / Answer
First of all
nextGen is the method which takes in a old generation string and returns a new generation string.
It has some rules to get this new generation String.
Call the getProd method inside nextGen
Using Scanner next method - Takes a string input
It takes the first letter/character and returns it .
There is a error in return statement - It is return c; Remove the inverted comma for c.
Add a for loop for getProd method so that all the characters are applied with prod Rules and convert it toString() and returns the new String as new generation