import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;

/**
 * Outputs a grammatically correct sentence with randomly selected words.
 *
 * @author Drue Coles
 */
public class LoveLetterGenerator {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        System.out.print("Enter recipient's name: ");
        String name = in.next();

        String[] verbs = {"cherish", "embrace", "fear", "hold", "seek"};

        String[] adverbs = {"deceptively", "intensely", "ominously", "strangely"};

        String[] adjectives = {"blinding", "evaporating", "infinite", "misty", 
            "overflowing", "shimmering"};

        String[] nouns = {"core", "gloom", "heart", "smile", "shadow"};

        // Dear [name], I will [verb] your [adverb] [adjective] [noun] forever!
        String verb = get(verbs);
        String adv = get(adverbs);
        String adj = get(adjectives);
        String noun = get(nouns);

        String letter = "Dear %s, I will %s your %s %s %s forever!";
        String hearts = "\u2764 \u2764 \u2764";
        System.out.printf(letter + " " + hearts + "%n", name, verb,  adv, adj, noun);
    }

    /**
     * Returns a randomly chosen string from a given array of strings.
     */
    private static String get(String[] array) {
        ThreadLocalRandom rand = ThreadLocalRandom.current();
        int n = rand.nextInt(array.length);
        return array[n];
    }
}