(Random Sentences) Write an application that uses random-number generation to create 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, concatenate it to the previous words in the sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and end with a period. The application should generate and display 20 sentences.
The article array should contain the articles "the", "a", "one", "some" and "any"; the noun array should contain the nouns "boy", "girl", "dog", "town" and "car"; the verb array should contain the verbs "drove", "jumped", "ran", "walked" and "skipped"; the preposition array should contain the prepositions "to", "from", "over", "under" and "on".
Â
Â
Answers
Status NEW
Posted 27 Apr 2017 05:04 AM
My Price 7.00
-----------
Attachments
file 1493272155-Answer.docx preview (444 words )
(-----------Ran-----------dom----------- Se-----------nte-----------nce-----------s) -----------Wri-----------te -----------an -----------app-----------lic-----------ati-----------on -----------tha-----------t u-----------ses----------- ra-----------ndo-----------m-n-----------umb-----------er -----------gen-----------era-----------tio-----------n t-----------o c-----------rea-----------te -----------sen-----------ten-----------ces-----------. U-----------se -----------fou-----------r a-----------rra-----------ys -----------of -----------str-----------ing-----------s c-----------all-----------ed -----------art-----------icl-----------e, -----------nou-----------n, -----------ver-----------b a-----------nd -----------pre-----------pos-----------iti-----------on.----------- Cr-----------eat-----------e a----------- se-----------nte-----------nce----------- by----------- se-----------lec-----------tin-----------g a----------- wo-----------rd -----------at -----------ran-----------dom----------- fr-----------om -----------eac-----------h a-----------rra-----------y i-----------n t-----------he -----------fol-----------low-----------ing----------- or-----------der-----------: a-----------rti-----------cle-----------, n-----------oun-----------, v-----------erb-----------, p-----------rep-----------osi-----------tio-----------n, -----------art-----------icl-----------e a-----------nd -----------nou-----------n. -----------As -----------eac-----------h w-----------ord----------- is----------- pi-----------cke-----------d, -----------con-----------cat-----------ena-----------te -----------it -----------to -----------the----------- pr-----------evi-----------ous----------- wo-----------rds----------- in----------- th-----------e s-----------ent-----------enc-----------e. -----------The----------- wo-----------rds----------- sh-----------oul-----------d b-----------e s-----------epa-----------rat-----------ed -----------by -----------spa-----------ces-----------. W-----------hen-----------
Not Rated(0)