Q1: [JF edited] In the language of an alien race, all words take

Added on -2019-09-16

| 1 pages
| 308 words

Trusted by 2+ million users,
1000+ happy students everyday

Showing pages 1 to 1 of 1 pages

Q1:[JF edited] In the language of an alien race, all words take the form of Blurbs. A Blurb is aWhoozitfollowed by between zero and tenWhatzits. AWhoozitis the character 'x' followed by between one and ten'y's. AWhatzitis a 'q' followed by either a 'z' or a 'd', followed by aWhoozit. Design and implement a recursive program that generates 10 random Blurbs in this alien language. (Hint: start by trying to generateWhoozits,Whatzits, and Blurbs by hand and on paper. Be sure to follow that order. Once you have a feeling for the structure of the language, then start to think about how you might program it.) [15 points]Sample Output:Q2:Considering thelanguagejust discussed, write a program that reads a string from the user, and checks whether or notis a valid sentence. If it is valid, it prints "The word is fine.", otherwise it prints "The word is a mess!" The program should loop and ask the user for new input until they enter DONE. (Hint: tryWhoozitsfirst, followed byWhatzits, and thenBlurbs. For each method, test it by running it on known valid strings generated by the methods you had to write for Q1.)Note: if it helps you, you can omit checking for the maximum number of timesWhatzitsor'y'soccur (e.g., "between one and ten" becomes "one or more").[20 points]Sample Output:

Found this document preview useful?

You are reading a preview
Upload your documents to download
Become a Desklib member to get accesss

Students who viewed this