Fund. CS II (CS152 2006S)

Homework 3: Mad-Libs, Simplified

Assigned: Tuesday, January 31, 2006
Due: 8:00 a.m., Wednesday, February 1, 2006

Summary: In this assignment, you will implement a simple version of the game Mad Libs.

Purpose: To give you an opportunity to explore issues of input and output in Java.



You may be familiar with the game Mad Libs. In this game of two or more players, one player serves as the questioner and the remaining players provide answers. The questioner works from a text in which certain words are missing and asks the players to submit words for those that are missing. The only detail that the questioner provides is the part of speech (or other description of the expected word). The questioner then reads the resulting text.

Consider the following text:

John likes to verb with Java
because he thinks that Java is adjective.
When things go well, John is adjective.
When things go badly, John yells "exclamation!"

In this case, the questioner would ask for a verb, two adjectives, and an exclamation. If the players provided the words sleep, green, stupid, and foo, the questioner would then read

John likes to sleep with Java
because he thinks that Java is green.
When things go well, John is stupid.
When things go badly, John yells "foo!"

The Assignment

Write a program the serves the role of the questioner in a pre-defined game of Mad Libs.

Your program should

A Sample Session

Please enter a verb: walk
Please enter an adjective: superfluous
Please enter an adjective: incredible
Please enter an exclamation: wicked

Here is your story ...

  John likes to walk with Java 
  because he thinks that Java is superfluous.
  When things go well, John is incredible.
  When things go badly, John yells "wicked!"

Submitting Your Work

When you are satisfied with your work, you should submit it to me. Please email me your Java code.


When you ask questions, I'll try to put the answers here.



Wednesday, 7 September 2005 [Samuel A. Rebelsky]

Monday, 12 September 2005 [Samuel A. Rebelsky]

Tuesday, 31 January 2006 [Samuel A. Rebelsky]


Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 9 08:31:07 2006.
The source to the document was last modified on Tue Jan 31 09:39:42 2006.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Samuel A. Rebelsky,