Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions