Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please Use The Files I Have Provided (Recursive Program) Use the following files to create a blurb generator that spits out words in an alien
Please Use The Files I Have Provided (Recursive Program)
Use the following files to create a blurb generator that spits out words in an alien language. The blurbs, which I will soon define, must consist of a Whoozit followed by a Whatzit. A Whoozit is defined as an 'x' character, followed by zero or more 'y' characters. A Whatzit is defined as a 'q' character, followed by either a 'z' or 'd' character, and concludes with a Whoozit (which I defined in the previous sentence).
FILE 1:
package asmt02Part04; import java.util.Random; /** * * @author JavaF */ public class BlurbGenerator { /** * Instantiates a random number generator needed for blurb creation. */ public BlurbGenerator() { } /** * Generates and returns a random Blurb. A Blurb is a Whoozit followed by * one or more Whatzits. * @return */ public String makeBlurb() { } /** * Generates a random Whoozit. A Whoozit is the character 'x' followed by * zero or more 'y's. */ private String makeWhoozit() { } /** * Recursively generates a string of zero or more 'y's. */ private String makeYString() { } /** * Recursively generates a string of one or more Whatzits. */ private String makeMultiWhatzits() { } /** * Generates a random Whatzit. A Whatzit is a 'q' followed by either a 'z' * or a 'd', followed by a Whoozit. */ private String makeWhatzit() { } }
FILE 2 (COMPLETE):
package asmt02Part04; import java.util.Scanner; public class Blurbs { /** * Generates a series of Blurbs (a word in an alien language). * * @param args */ public static void main(String args[]) { BlurbGenerator blurbMaker = new BlurbGenerator(); Scanner scan = new Scanner(System.in); System.out.println("How many blurbs would you like? "); int numBlurbs = scan.nextInt(); for (int i = 1; i <= numBlurbs; i++) { System.out.println("Blurb #" + i + ": " + blurbMaker.makeBlurb()); } } }
THANKS AND GOOD LUCK
Step 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