Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a helper method reverse which takes in a string and returns the string backwards. For example, if given Hello, it will return olleH
Write a helper method reverse which takes in a string and returns the string backwards. For example, if given "Hello", it will return "olleH" o 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. o 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).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started