More Simple Calculations (Second Lab)
EDW749 - Summer 2006

Dr. Roger Webster

Goals
- to use the MU computer facilities
- to use the editor
- to use the compiler

- to build problem solving skills using Java

Overview
For this assignment, you will write a program to
keep track of a Coin Collection.

Problem Description
 

Problem statement
Saving nickels and pennies and want to exchange these coins at the bank so need to know the value of coins in dollars and cents.
Analysis
Need to count of nickels and pennies separately
Determine total value in cents
Use integer division by 100 to calculate dollars
Use modulus (%) to get remaining cents
Problem input
–        string name
    integer nickels
    integer pennies
Problem output
    integer dollars
    integer change
Additional program variables
    integer totalCents
One dollar equals 100 pennies
One nickel equals 5 pennies
Algorithm:
1. Read in your niece’s first name
2. Read in the count of nickels and pennies
3. Compute the total value in cents
    3.1 totalCents is 5 times nickels plus pennies
4. Find the value in dollars and loose change.
    4.1 dollars is integer quotient of totalCents and 100
    4.2 change is integer remainer of totalCents and 100
5. Display the value in dollars and loose change.

Sample Execution:

Enter your first name: Sally
Enter the number of nickels: 30
Enter the number of pennies: 77
Good work Sally!
Your collection is worth 2 dollars and 27 cents.

When you are done with the program, print it out and hand it in.