Expert answer:Need programming help for using the random number

Answer & Explanation:Write a short Java application that stores words in an Array or ArrayList. You get to pick the number of words to store. Generate a random number between 0 (inclusive) and the length of the Array or ArrayList (exclusive). Use this random number as an index into the Array or ArrayList. Display the value stored at the index. Take a screenshot to verify that the words in your Array or ArrayList are displayed successfully. Cut and paste the screenshot into a Word document and attach this document to your submission. Here is my code below but I’m not sure how to generate an index number. Also, is my code done correctly. Please advise.WordTE.txt
wordte.txt

wordte.txt

wordte.txt

wordte.txt

Unformatted Attachment Preview

package wordup;
/**
*
* @author philip.johnson1
*/
public class WordUp
{
public static void main(String[] args)
{
System.out.println ( “Display my words list.”);
for ( int i = 0; i < 4; i ++ ) { System.out.println ( Sentence () ); } } public static String Sentence () { int value = 0; String msg = ""; String [] subject = { "beast", "lion", "lamb" }; String [] adverb = { "slowly", "develop", "speed" String [] verb = { "shifts", "adapts", "hibernate" }; }; String [] adjective = { "jumps", "runs", "hides in" }; String [] object = { "boat", "village", "land" }; String vowels = "aeiouAEIOU"; value = ( int ) ( Math.random () * 3 ); //check if names starts with a vowel if( vowels.contains ( "" + subject [ value ].charAt ( 0 ) ) ) { msg = 1 + "." + "An " + subject [ value ]; } else { msg = "A " + subject [ value ]; } //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adverb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + verb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adjective [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); if ( vowels.contains ( "" + object [ value ].charAt ( 0 ) ) ) { msg = msg + " an " + object [ value ] + "."; } else { msg = msg + " a " + object [ value ] + "."; return msg; } } } package wordup; /** * * @author philip.johnson1 */ public class WordUp { public static void main(String[] args) { System.out.println ( "Display my words list."); for ( int i = 0; i < 4; i ++ ) { System.out.println ( Sentence () ); } } public static String Sentence () { int value = 0; String msg = ""; String [] subject = { "beast", "lion", "lamb" }; String [] adverb = { "slowly", "develop", "speed" String [] verb = { "shifts", "adapts", "hibernate" }; }; String [] adjective = { "jumps", "runs", "hides in" }; String [] object = { "boat", "village", "land" }; String vowels = "aeiouAEIOU"; value = ( int ) ( Math.random () * 3 ); //check if names starts with a vowel if( vowels.contains ( "" + subject [ value ].charAt ( 0 ) ) ) { msg = 1 + "." + "An " + subject [ value ]; } else { msg = "A " + subject [ value ]; } //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adverb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + verb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adjective [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); if ( vowels.contains ( "" + object [ value ].charAt ( 0 ) ) ) { msg = msg + " an " + object [ value ] + "."; } else { msg = msg + " a " + object [ value ] + "."; return msg; } } } package wordup; /** * * @author philip.johnson1 */ public class WordUp { public static void main(String[] args) { System.out.println ( "Display my words list."); for ( int i = 0; i < 4; i ++ ) { System.out.println ( Sentence () ); } } public static String Sentence () { int value = 0; String msg = ""; String [] subject = { "beast", "lion", "lamb" }; String [] adverb = { "slowly", "develop", "speed" String [] verb = { "shifts", "adapts", "hibernate" }; }; String [] adjective = { "jumps", "runs", "hides in" }; String [] object = { "boat", "village", "land" }; String vowels = "aeiouAEIOU"; value = ( int ) ( Math.random () * 3 ); //check if names starts with a vowel if( vowels.contains ( "" + subject [ value ].charAt ( 0 ) ) ) { msg = 1 + "." + "An " + subject [ value ]; } else { msg = "A " + subject [ value ]; } //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adverb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + verb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adjective [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); if ( vowels.contains ( "" + object [ value ].charAt ( 0 ) ) ) { msg = msg + " an " + object [ value ] + "."; } else { msg = msg + " a " + object [ value ] + "."; return msg; } } } package wordup; /** * * @author philip.johnson1 */ public class WordUp { public static void main(String[] args) { System.out.println ( "Display my words list."); for ( int i = 0; i < 4; i ++ ) { System.out.println ( Sentence () ); } } public static String Sentence () { int value = 0; String msg = ""; String [] subject = { "beast", "lion", "lamb" }; String [] adverb = { "slowly", "develop", "speed" String [] verb = { "shifts", "adapts", "hibernate" }; }; String [] adjective = { "jumps", "runs", "hides in" }; String [] object = { "boat", "village", "land" }; String vowels = "aeiouAEIOU"; value = ( int ) ( Math.random () * 3 ); //check if names starts with a vowel if( vowels.contains ( "" + subject [ value ].charAt ( 0 ) ) ) { msg = 1 + "." + "An " + subject [ value ]; } else { msg = "A " + subject [ value ]; } //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adverb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + verb [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); msg = msg + " " + adjective [ value ]; //The math.random function will roll the dice 3 times. value = ( int ) ( Math.random () * 3 ); if ( vowels.contains ( "" + object [ value ].charAt ( 0 ) ) ) { msg = msg + " an " + object [ value ] + "."; } else { msg = msg + " a " + object [ value ] + "."; return msg; } } } ... Purchase answer to see full attachment

How it works

  1. Paste your instructions in the instructions box. You can also attach an instructions file
  2. Select the writer category, deadline, education level and review the instructions 
  3. Make a payment for the order to be assignment to a writer
  4.  Download the paper after the writer uploads it 

Will the writer plagiarize my essay?

You will get a plagiarism-free paper and you can get an originality report upon request.

Is this service safe?

All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 20% with the discount code ESSAYHELP