Download Program Assignment #1 (25 points)

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Program Assignment #1 (30 points)
Due: Monday, June 21
Write a Java program that directs a cashier to give correct change to a customer.
The program has two inputs: the amount due and the amount received from the customer.
Your program should compute the difference, then compute and display the number of
dollars, quarters, dimes, nickels and pennies that the customer should receive in change.
You may assume that the amount paid will always be greater than the amount due.
A sample run of the program might look like this:
How much was the total? 32.95
How much did the customer pay? 35.00
Change is: 2.05
That is 2 dollar(s), 0 quarter(s), 0 dime(s), 1 nickel(s) and 0 penny(s).
Thank you for making change with me!
The amounts should be read in as floating-point numbers, but the difference
between them will have to converted to an integer in order to calculate the change
denominations, because this will involve the use of modular division. Your general
strategy might be as follows:
Read in the two numbers, then calculate and display the difference;
Convert the resulting balance from dollars and cents to cents and assign the result to
an int variable;
Calculate the dollar amount (anything greater than 100), display the amount and then
subtract it from the balance;
Calculate the number of quarters, display it and subtract the amount in quarters from
the balance;
Repeat the step above for dimes, nickels and pennies.
Follow the documentation and style guidelines given in class to lay out and comment
your program. Your score out of 30 possible points will be determined as stated in the
“Scoring Rubric” you have received; briefly, points will be awarded as follows:
1. Program is error-free: 11 points
2. Program meets stated specifications: 11 points
3. Program follows documentation & style guidelines: 8 points
Computer Science I
cs1Sum10p1 – work
Summer 2010
Page 1