Question: I want someone help me to solve this in java plz. Problem 2: A game called WFF 'N PROOF uses the following three rules to

I want someone help me to solve this in java plz. ProblemI want someone help me to solve this in java plz.

Problem 2: A game called WFF 'N PROOF uses the following three rules to define a well-formed formula, or WFF: 1. Any one of the letters p, q, r, or s is a WFF 2. A letter N, followed by a WFF, is a WFF. 3. Any one of the letters C, A, K, or E, followed by two WFFs, is a WFF. For instance, the following are WFFs Kpq NNp ApNq The following, however, are not WFFs: pq Rule 1 Rules 1 and 2 Rules 1 and 3 Rules 1 and 2 (twice) Rules 1, 2, and 3 pAq NE Using this recursive definition, you can construct quite complicated WFFs. Prove to yourself that this string represents a WFF: NNECpNKNpAqrs Write recursive method called WFF. Write a main method program that reads in character strings and determines whether they represent WFFs use the method WFF. Note that, in the rules above, some letters are uppercase and some are lowercase. Your program must be case sensitive. (That is, "Apq" is a WFF, but "APQ" is not.) Input The input consists of strings of characters, one per line, and each representing a possible WFF to be checked The input is in a file called www.in. Output For each input line print two output line, one line contains the inputted string, the other line contains the results of the WFF test

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!