/*
Chapter 3
Programming Assignment #3
Programmer:
Brad Shedd
Date:
April 26, 2006
Program Name:
Coins.java
*/
import java.io.*;
public
class
Coins
{
public
static
void
main(String[] args)
throws
IOException
{
BufferedReader dataIn =
new
BufferedReader(new
InputStreamReader(System.in));
//Declaring
Variables
int
quarters;
int
dimes;
int
nickels;
int
pennies;
int
dollars;
int
totalCents;
int
cents;
String
strQuarters;
String
strDimes;
String
strNickels;
String
strPennies;
System.out.println("What
is the number of quarters?");
strQuarters = dataIn.readLine();
System.out.println("What
is the number of dimes?");
strDimes = dataIn.readLine();
System.out.println("What
is the number of nickels?");
strNickels = dataIn.readLine();
System.out.println("What
is the number fo pennies?");
strPennies = dataIn.readLine();
//Calculations
quarters = Integer.parseInt(strQuarters)*25;
dimes =
Integer.parseInt(strDimes)*10;
nickels =
Integer.parseInt(strNickels)*5;
pennies =
Integer.parseInt(strPennies)*1;
//Conversions
totalCents = quarters + dimes + nickels + pennies;
dollars =
(totalCents / 100);
cents =
(totalCents % 100);
//Output
System.out.println("Your
change equalled "+ dollars+"
dollars and "+cents+" cents");
}
}