Question: IN C# WITH SCREENSHOTS OF THE CODE RECURSION - PAPERFOLDS Concept Summary: 1. Recursion For this assignment1 you will design a recursive method and themain

IN C# WITH SCREENSHOTS OF THE CODE

RECURSION - PAPERFOLDS

Concept Summary:

1. Recursion

For this assignment1 you will design a recursive method and themain program that calls the recursive method.

Description

Take a piece of paper and fold it in half. Unfold it and thereis one fold, which I'll signify with a "v". If you fold the papertwice (always keeping the folds in the same direction and thecreases parallel), it will have three folds when you unfold it, andthey will be in a "^ v v" pattern. Fold a piece of paper threetimes, and you will see "^ ^ v v ^ v v" as the sequence offolds.Folding a piece of already folded paper sounds a lot likerecursion, 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 reversedand flipped over, then a

    "v" fold, and then the pattern you already have tacked on theend.

    Submission Guidelines:

    Turn in 1 program file that calls the recursive method from theMain program.

    Assignment:

  • Write a static method, paperFold, which is a recursive routinethat returns a string representing the fold pattern for a paperfolded n times. The driver program that calls the paperFold ()method

  • Write one or more helper methods to generate a string that takesa fold sequence and returns it reversed and flipped over such thata "v ^ ^ ^" becomes a "v v v ^".Hint: You could write one to reverse the string and one to flip thestring. As in many recursive solutions, expect the fold method tobe extremely simple (and of course recursive).

  • 1 program file that calls the recursive method from the Mainprogram.

Skeleton Code Java Version class TestPaperFolds { public static void main(String[] args)

} for (int i=1;i

Skeleton Code Java Version class TestPaperFolds { public static void main(String[] args) } for (int i=1;i

Step by Step Solution

3.47 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is an example implementation of the paperFold method in C using recursion using System class Ma... View full answer

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 Programming Questions!