Question: I need help with the following code. I have the correct production rules but can't figure out how to correctly determine the next generation if

 I need help with the following code. I have the correct

I need help with the following code. I have the correct production rules but can't figure out how to correctly determine the next generation if the current generation isn't: A, B, +, or -. If the current generation is A my code will correctly display the next generation as: +B-A-B+. However, if I start of with +B-A-B+ as the current generation, the next generation is only computed as: +. I understand I need to implement a for loop for the getProd() method but I can't seem to figure this out and I have been going crazy because I can't figure it out.

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 nextGen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!