Question: C# Source Code Needed Concept Summary: Recursion For this assignment' you will design a recursive method and the main program that calls the recursive method

C# Source Code Needed  C# Source Code Needed Concept Summary: Recursion For this assignment' you
will design a recursive method and the main program that calls the
recursive method 1. This amgnment has been adapted from the Roger Prunk

Concept Summary: Recursion For this assignment' you will design a recursive method and the main program that calls the recursive method 1. This amgnment has been adapted from the Roger Prunk collection Description Take a piece of paper and fold it in half. Unfold it and there is one fold, which I'll signify with a "v". If you fold the paper twice (always keeping the folds in the same direction and the creases parallel), it will have three folds when you unfold it, and they will be in a "vy" pattern. Fold a piece of paper three times, and you will see "Avv^vv" as the sequence of folds. Folding a piece of already folded paper sounds a lot like recursion, and indeed it is. In case you can't see the algorithm, here it is: If you fold a paper once, the fold pattern is "V". For additional folds, it is the pattern you have only reversed and flipped over, then a "v" fold, and then the pattern you already have tacked on the end. Assignment: Write a helper method reverse which takes in a string and returns the string backwards. For example, if given "Hello", it will return "olleH" Hints (you don't have to use these, but they may be helpful): You can convert a string to an array of characters using (Java) string.toCharArray) or (C#) string.ToCharArray(); . Once you have an array of characters, you can reverse them pretty easily You can convert an array of characters back to a string with (Java) String x=new String(charArray) or (C#) string x = new string(charArray); You may use a loop or recursion for this method. Write a helper method which converts all to v and all v to in a string. It should take in and return a string Hint: You may find (Java) string.replace() or (C#) String.Replace() useful. Write a static method, paperFold, which is a recursive routine that returns a string representing the fold pattern for a paper folded n times. The driver program will call the paperFold method As in many recursive solutions, expect the paperFold method to be extremely simple (and of course recursive). Main method in Java: public static void main(String[] args) { for(int i=1;i

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!