subject

In the language of an alien race, all words take the form of Blurbs. A blurb is a Whoozit followed by one or more Whatzits. A Whoozit is the character ‘x’ followed by zero or more ‘y’s. A Whatzit is a ‘q’ followed by either a ‘z’ or a ‘d’ followed by a Whoozit.1. Design and implement a program that generates blurbs and asks the user for how many blurbs they would like.2. Design and implement a recursive program that check a given string to be a Blurb or not. The program should repetitively prompt the users for more string to check till the user decide to stop. I already did part one here, but I still need help with part 2.import java. util. Random;import java. util. Scanner;public class BlurbyBlurb //naming corresponds to{// random number generator used by all functionspublic static Random r = new Random(); public static String Blurb(){String result = Whoozit(); // A Blurb is a Whoozitint num = r. nextInt(9) + 1;for (int i = 0; i < num; i++) //followed by one or more Whatzits.{result += Whatzit();}return result;}public static String Whoozit(){String result = "x"; // A Whoozit is the character 'x' ...int num = r. nextInt(9);for (int i = 0; i < num; i++){result += "y"; // followed by zero or more 'y's.}return result;}public static String Whatzit(){String result = "q"; // A Whatzit is a 'q'int num = r. nextInt(2);if (num == 0){result += "z"; // followed by either a 'z' or a 'd',}else // (num == 1){result += "d";}result += Whoozit(); // followed by a Whoozit. return result;}public static void main(String[] args){Scanner scan = new Scanner(System. in); System. out. println("This program makes Blurbs.");System. out. println("How many blurbs do you want?");int n = scan. nextInt();while (n > 0){System. out. println(Blurb());n--;}}}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 21:00, depression4eternity
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
image
Computers and Technology, 24.06.2019 13:30, tami5
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
image
Computers and Technology, 24.06.2019 16:30, kjhgfcvb5761
The database design steps are listed below in the incorrect order. choose the correct order number next to each step. determine the information to be stored in the database. determine the fields needed to record the data determine if there will be any repetition of data entered, and separate the fields into tables to normalize the data. create relationships to connect the tables.
Answers: 3
image
Computers and Technology, 24.06.2019 17:50, veneciaconton347
You will subnet the network address 172.31.103.0/24. the network has the following requirements: · room-114 lan will require 27 host ip addresses · room-279 lan will require 25 host ip addresses · room-312 lan will require 14 host ip addresses · room-407 lan will require 8 host ip addresses how many subnets are needed in the network topology?
Answers: 2
You know the right answer?
In the language of an alien race, all words take the form of Blurbs. A blurb is a Whoozit followed b...

Questions in other subjects:

Konu
History, 26.07.2019 16:30