Question: 1. Write a java program that calls a recursive method called repeat that accepts a string s and an integer n as parameters and that

1. Write a java program that calls a recursive method called repeat that accepts a string s and an integer n as parameters and that returns s concatenated together n times. For example: repeat(cs, 3) returns cscscs, repeat (cs, 0) returns .

2. Write a recursive method isReverse that accepts two strings as a parameter and returns true if the two strings contain the same sequence of characters as each other but in the reverse order. For example, the string "hello" backwards is "olleh", so a call of isReverse("Java", "avaJ") would return true and isReverse( Java, ava) would return false.

3. Write a recursive method called starString that accepts an integer as a parameter and prints to the console a string of starts (asterisks) that is 2n (i.e. 2 to the nth power) long. For example: starString(0) should print * (because 2^0 == 1) starString(2) should print **** (because 2^2 == 4) starStrting(4) should print **************** (because 2^4 == 16)

Do so in Java!!!

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!