logo

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

1 Pages308 Words208 Views
   

Added on  2019-09-16

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

   Added on 2019-09-16

ShareRelated Documents
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:
Q1: [JF edited] In the language of an alien race, all words take_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Programming, Algorithms and Data Structure: Weekly Tasks and Exercises
|2
|501
|348

SEO for Desklib
|2
|890
|424

MITS4002 Activity 07.
|3
|414
|301

Assignment | Console-based Program in Python 3
|7
|3311
|459

Task 2. 2.2 The main part of the program can use a FOR
|9
|750
|196

Console-based Program in Python: Assignment
|7
|3292
|411