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:
- Use an editor to create a java source file from scratch.
- Write java code to create an attractive user interface.
- Write java code to perform basic arithmetic calculations and String manipulation.
- Use the proper
next????
method from the Scanner
class.
- Use the
NumberFormat
or DecimalFormat
class to properly format currency values.
- Do everything necessary to create, debug, and run a java program.
- Use comments to delineate each section of the program.
- Adhere to a Style Guide.
- READ AND FOLLOW DIRECTIONS!!!!!
Deadlines
- Submit: September 25, 2007 by 11:59pm. Use your instructor's preferred submission mechanism.
- Report: September 26, 2007 by the beginning of class. A 20
points/day late penalty will apply for each of the 2 deadlines. If the
submit is late, the report is due the next class or lab session day after
successful submission. Programs will not be accepted after 3 days late.
Prerequisites
You have covered the material in Chapter 2 of Gaddis.
Program Behavior
Your application must do these things:
- Your program will prompt for and read five input values. These are:
- A person's name (as a String)
- An unusual pet (as a String)
- A pet's name (as a String)
- An hourly wage (as a double).
- Hours worked in a week (as an integer).
- You program will calculate the weekly pay (wage * hours).
- Your program must display the story (specified below) with the missing elements filled in by the input or calculated values.
- All output must be properly formatted. For example, the wage and pay must be in currency format.
Output
- Output the heading, "Welcome to the CS139 Mad Lib game" followed by
the newline character.
- Output a blank line.
- 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.
- Your first input prompt must be the String, "Enter a person's name: "
- Your second input prompt must be the String, "Enter an unusual pet: "
- Your third input prompt must be the String, "Enter the pet's name: "
- Your fourth input prompt must be the String, "Enter an hourly wage: "
- Your fifth and final input prompt must be the String, "Enter the hours worked: "
- 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
- You must use variables for the values of the input parameters.
- 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.
- If you received no help your acknowledgement section should have a
statement to that effect.
- 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
- Your program will be evaluated both by its correctness and conformance to the required elements.
- You will achieve a grade of 80 for a program that runs correctly
and produces exactly the required output in the required format.
- The remainder (20) will be based on your conformance to the Style and other
requirements of the assignment. Review the Style Guide before submitting your program and the grade sheet which is produced by the submit system.
- All grades will be based on 100 points.
- You may submit any number of times. The only one I will count is the
one that corresponds to the hardcopy report that you turn in.
- The hardcopy that you turn in will be the formatted version that
I will check. Make sure it has no line wraps or other spacing
issues.
- Successfully submitted programs that are late will be graded, then the 20 point penalty assessed for each day late.
HINTS
- Begin early. Students run into trouble by waiting too long to start the program.
- Understand the problem at hand. Make sure that you follow
the requirements precisely. Don't add additional "flourishes".
You will be downgraded.
- Design a top level algorithm. Don't worry as you are
designing that you might not yet know how to do input or format output.
Design as if you have those tools. You will get them before
it is due.
- Design your substeps, at least the ones you can do now.
Fill in the others as we cover material in class or you study it
in your book.
- Your top level algorithm can be used as step documentation in your program. Start there.