Project 1: Mad Libs

In this project you will write a program that plays the game Mad Libs. Mad Libs involve a story or essay with important words left out. Players unaware of the text are asked to fill in the blanks with words with the given parts of speech. (Often something more specific is asked for, such as "past tense verb," "proper noun," or even "food.")

1. Setup

Bring up a terminal window (Applications->Accessories->Terminal). First you will want to make a directory for this class, change into that directory, make a directory for this project, and again change into it.

mkdir csci235
cd csci235
mkdir proj1
cd proj1

Start Emacs, giving as an argument the file named something like "MadLibs.java".

emacs MadLibs.java &

2. Program

Write or find a story or other text that can be changed into a Mad Lib. Write a program that asks the user for a series of words, for example,

noun--> computer
past tense verb--> walked
interjection--> splat
...

Then display the story or essay with the words filled in the right place. Your program should meet the following specifications:

I will not take off points for documentation this time, but documenation will be part of your grade on future projects. Accordingly, do your best to imitate the way I document the examples we have in class. Also, try to format your program neatly.

3. Turn in

When you are all finished and are confident that your program fulfills all the instructions here and is working right, do the following:

Print your source (.java) file and your script:

a2ps -Pcs -2 --file-align=virtual MadLibs.java typescript
Turn in the hard copy in class or put it in my box.

Turn the script and source file in as project1:

$ /cslab/class/csci235/bin/handin project1 typescript MadLibs.java

DUE: Monday, Sept. 16, at 5:00 PM.


Original by Thomas VanDrunen
Last modified: Mon Sep 9 10:53:27 CDT 2013