Question: JAVA: Write a recursive function that will test to see if the input String parameter belongs to the following format: L = {S : S

JAVA:

Write a recursive function that will test to see if the input String parameter belongs to the following format:

L = {S : S is in the form of AnB3n, for some n >= 0} where n and 3n are powers.

Test your function in main function.

The class should have two methods:

public static boolean IsIn(String w){ //body};

public static void main(String[] args)

public static void main(String[] args){

String str ="AABBBBBB";

if(IsIn(str))

System.out.println("The string " + str + " is in the language.");

else

System.out.println("The string " + str + " is in NOT the language.");

}

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!