/* Prompt user for an ADJECTIVE, then a past tense verb VERBED, then a NOUN to print the following mad-lib sentence: The ADJECTIVE professor VERBED my NOUN, and I've never recovered. Author: Alan Renaud, CS100 TA Date: 3 July 1999 */ import java.io.*; public class P1_3 { public static void main(String args[]) { // initialize Text object in to read from standard input. TokenReader in = new TokenReader(System.in); String adj; // the adjective String verb; String noun; // prompt user for adjective, verb, and noun System.out.print("Enter an adjective: "); System.out.flush(); adj = in.readString(); System.out.print("Enter a verb in the past tense: "); System.out.flush(); verb = in.readString(); System.out.print("Enter a noun: "); System.out.flush(); noun = in.readString(); // display madlib System.out.println( "The " + adj + " professor " + verb + " my " + noun + ", and I've never recovered."); // Wait for user to enter input to ensure console window remains visible in.waitUntilEnter(); } } /* Sample output: -------------------------------------------------------------------------------------------- Enter an adjective: cranky Enter a verb in the past tense: graded Enter a noun: paper The cranky professor graded my paper, and I've never recovered. -------------------------------------------------------------------------------------------- Enter an adjective: purple Enter a verb in the past tense: ate Enter a noun: computer The purple professor ate my computer, and I've never recovered. -------------------------------------------------------------------------------------------- Enter an adjective: angry Enter a verb in the past tense: kicked Enter a noun: cat The angry professor kicked my cat, and I've never recovered. */