All pastes #1979208 Raw Edit

Mine

public text v1 · immutable
#1979208 ·published 2010-11-02 00:05 UTC
rendered paste body
import java.util.Scanner;
import java.util.Random;

class Sentences
{
   // create method to get random array entry
	public static String get(String[] array)
	{
		Random r1 = new Random();
		int rnd = r1.nextInt(array.length);
		return array[rnd];
	}
	
	public static void main(String[] args)
	{
	
		Scanner in = new Scanner(System.in);
		//delclare variables
		String inputNouns;
		String inputVerbs;
		String selectArticle;
		String selectNoun;
		String selectVerb;
		String selectPreposition;
		String selectArticle2;
		String selectNoun2;
		String first;
		String rest;
		String capitalize;
		int counter;
		
		//create dialog and user input 
		System.out.print("Enter 5 nouns (lowercase): ");
		inputNouns = in.nextLine(); 
		System.out.print("Enter 5 past tense verbs (lowercase): ");
		inputVerbs = in.nextLine();
		
		
		// declare arrays
		String[] article = {"the", "a", "one", "some", "any"};
		String[] noun = inputNouns.split(" ");
		String[] verb = inputVerbs.split(" ");
		String[] preposition = {"to", "from", "over", "under", "on"};
		System.out.println("");
		
		//establish a loop to concatenate the 6 words together into a sentence
		for (counter = 0; counter < 20; counter++)
		{
		selectArticle = get(article);
		selectNoun = get(noun);
		selectVerb = get(verb);
		selectPreposition = get(preposition);
		selectArticle2 = get(article);
		selectNoun2 = get(noun);
		//tell the program to capitalize the first letter
		first = selectArticle.substring(0,1);
		rest = selectArticle.substring(1);
		capitalize = first.toUpperCase() + rest.toLowerCase();
		System.out.println(capitalize + " " + selectNoun + " " + selectVerb + " " + selectPreposition + " " + selectArticle2 + " " + selectNoun2 + ".");
		}
		
		
		
		
		
		
		
		
		
		
	}
}