Question: 8.2 (Random Sentences) Write a script that uses random-number generation to com- pose sentences. Use four arrays of strings called article, noun, verb and

8.2 (Random Sentences) Write a script that uses random-number generation to com-

8.2 (Random Sentences) Write a script that uses random-number generation to com- pose sentences. Use four arrays of strings called article, noun, verb and preposition. Create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, concate- nate it to the previous words in the sentence. Spaces should separate the words. When the final sentence is output, it should start with a capital letter and end with a period. The script should generate and display 20 sentences.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!