Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 testStep 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