CS139 Algorithm Development

Software Requirements Specification

Programming Assignment 1

Mad Libs

Due Tuesday, September 25 by 11:59pm (midnight)


Introduction

Purpose: This program will play a game with the user.  The user will provide a series of words and numbers and the computer will use those words to produce a Mad lib style story.  Mad libs consist of a text with blanks.  The player is asked for a specific series of words and the reader fills those into the story for the blanks.  See the web site:  http://www.eduplace.com/tales/ for some examples. 

Objectives - At the conclusion of this exercise the student will demonstrate that they can:

Deadlines

Prerequisites

You have covered the material in Chapter 2 of Gaddis.  

Program Behavior

Your application must do these things:

  1. Your program will prompt for and read five input values.  These are:
    1. A person's name (as a String)
    2. An unusual pet (as a String)
    3. A pet's name (as a String)
    4. An hourly wage (as a double).
    5. Hours worked in a week (as an integer).
  2. You program will calculate the weekly pay (wage * hours).
  3. Your program must display the story (specified below) with the missing elements filled in by the input or calculated values.
  4. All output must be properly formatted.  For example, the wage and pay must be in currency format.

Output

  1. Output the heading, "Welcome to the CS139 Mad Lib game" followed by the newline character.
  2. Output a blank line.
  3. Prompt for the input values. Output the newline character after reading the each input value and before the next prompt. Note: your input will be on the same line as the prompt.
    1. Your first input prompt must be the String, "Enter a person's name: "
    2. Your second input prompt must be the String, "Enter an unusual pet:  "
    3. Your third input prompt must be the String, "Enter the pet's name: "
    4. Your fourth input prompt must be the String, "Enter an hourly wage: "
    5. Your fifth and final input prompt must be the String, "Enter the hours worked: "
  4. After reading all of the input values, output a blank line then story as follows:  The bold values are the substitutions.  The story must be formatted as shown:
petName's Story

Once upon a time there was a student named studentName,
who had a pet petType.
petName, the petType, ate so much
that studentName had to get a part-time job. studentName
was paid hourlyWage per hour and worked hours hours per week
just to take care of petName. studentName made pay per
week and it was just enough money to pay for petName's food.

Additional Program Requirements

  1. You must use variables for the values of the input parameters.
  2. Your program must include an acknowledgement section acknowledging help received from TAs or reference sources. You do not need to reference receiving help from the instructor.
  3. If you received no help your acknowledgement section should have a statement to that effect.
  4. Your program must conform to standard Java programming standards and the additional standards for this class. See the Style Guide for your class.

Honor Code

This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by another student to another student. Authorized help is limited to your textbook, the TA’s for any CS139 section, and the professor for your section. See collaboration policy.

Grading

HINTS