Question: Can I get some assistance with this please? --------------------------------------------------------------------------------------------------------------- Overview In this challenge, you will create a program named SurpriseSentences that creates sentences by combining

Can I get some assistance with this please?

Can I get some assistance with this please? --------------------------------------------------------------------------------------------------------------- Overview In this

---------------------------------------------------------------------------------------------------------------

challenge, you will create a program named SurpriseSentences that creates sentences by

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: . . 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. * 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) o Use a loop to create and display 20 surprise sentences . Construct each sentence using a random selection from each array for each word in the sentence in the following order: o determiner, noun, verb, preposition, determiner and noun To do this, you'll create a new randomized array of each type and fill it within the loop. For example, for the "determiner", you could include a statement similar to the following to randomly select an array location o o int determiner! = generator . next Int (determinerlength); Then build each sentence by creating a new Stringbuilder and appending the selected array value. After the sentence is built, display the sentence with the first letter capitalized. Hint: Use the StringBuffer's setCharAt method. The first parameter is the index of the first letter of the sentence and the second parameter should call the Character.toUpperCase method. o o

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 Databases Questions!