Question: Language: Java Overview In this challenge, you will create a program named Surprisesentences that creates sentences by combining words from arrays (based on parts of
Overview In this challenge, you will create a program named Surprisesentences that creates sentences by combining words from arrays (based on parts of speech) with word selections. Each word in the sentence will be chosen randomly. The word choices will be stored in four separate String arrays. A Random object will be declared and used to select the random word in each part of the sentence. Note: you'll create one class for this application and this class will include the driver (main) method. Specifications Create the skeleton for a program names Surprisesentences. You may start with the skeleton at the end of this document if helpful In the main method, declare and initialize a Random object named generator by calling a Random constructor that takes no arguments. Create four arrays of strings and initialize each string with the values shown: e o determiner array: "the", a", "one", "some", and "any" o noun array: "boy", "girl", "dog", "town", and 'car" o verb array: "drove", "jumped", ran", "walked", and "skipped" o preposition array: "to", "from", "over", "under", and "on Now, design the code to create a surprise sentence. You must use a StringBuilder object and the StringBuilder append method to create your sentence and add a period at the end of the sentence. o Note the most elegant approach for including spaces and commas is to use the append method, but you may include these within your array strings if you prefer)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
