CS139
Algorithm Development
|
Software
Requirements Specification
Programming Assignment 1
Change Maker
Due Friday, September 24 by 5:00pm
Introduction
Purpose:
This program is designed to calculate and display the number of coins
required to make change for an amount read in from the keyboard.
Objectives - At the
conclusion of this exercise the student will demonstrate that they can:
- Input data from a keyboard.
- 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 24, 2010
by 5:00pm.
- Report: September 27, 2010
at
the beginning of class. A 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 7 days late.
Prerequisites
You have covered the material
in Chapter 2 of Gaddis.
Background
When making change, there is a process that cashiers use involving
counting back from the highest coin available through the lowest. So if
I needed to make $.87 cents in change, I would first determine how many
quarters I needed. 3 will give $.75 leaving 12 cents to go. I would
then count out 1 dime leaving 2 cents. Since nickels are too large, I
would have 0 nickels and 2 pennies. In this program, you will build a
change maker which will display for any given amount the number of
dollar, quarter, dime, nickel, and penny amounts required to make that
amount of change.
Example
$1.42 would be 1 dollar, 1 quarter, 1 dime, 1 nickel, and 2 penney
coins.
Program
Behavior
Your application must be named ChangeMaker.
Your application must do these
things:
- Your program will prompt for
and read one input values. It is:
- The amount to make change for as a double.
- Your application must calculate the number of each coin required
to make the change.
- Your application must display the change in the format specified
below.
Output
- Output the heading, "Welcome to the Change Maker"
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 the total amount of change: ".
- After reading the
input values, output a blank line
then the name of the heading, "Amount of change for $A.AA is:". Substitute the amount entered for the A.AA.
- On the next
line print
out a
tab character, then " Dollars: DDD" Substitute the number of dollar coins for the
DDD.
- On the next
line print
out a
tab character, then "Quarters: QQQ" Substitute the number of quarter coins for the
QQQ.
- On the next
line print
out a
tab character, then " Dimes: DDD" Substitute the number of dime coins for the DDD.
- On the next
line print
out a
tab character, then " Nickels: NNN" Substitute the number of nickel coins for the
NNN.
- On the next
line print
out a
tab character, then " Pennies: PPP" Substitute the number of penney coins for the
PPP.
Sample output
Welcome to the Change Maker
Enter the total amount of change:
Amount of change for $1.42 is:
Dollars: 1
Quarters: 1
Dimes: 1
Nickels: 1
Pennies: 2
Error handling
You will not need to perform any error handling. Assume that
the
values being entered is a double.Additional Program Requirements
- You must use variables for
the values of the input.
- You must use constants for the value of each of the coins.
- In the documentation for the main
method, you must supply three
different examples of the calculation, showing the change value and
coin quantities. You may use your group's examples from class.
This is worth 10 points.
- 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 any student to another
student.
Authorized help is limited to your textbook, the TAs for any
CS139
or CS239 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
70 for a program that runs correctly
and produces exactly the required output in the required format. (It passes submit tests.)
- Documented examples - 10
points.
- The remainder (20 points)
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 late penalty is
assessed for each day late according to the following schedule.
For
submissions after:
- Sept 24 - 5 points
- Sept 26 - 15 points
- Sept 27 - 25 points
- Sept 28 - 35 points
- Sept 29 - 45 points
- Sept 30 - 100 points
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.
- In the body of your main
method, outline your steps with comment lines for each part of the
project.