need to have an input of money to pay for an item and amount given.
to return change due with denomination format:
_ 20 dollar bills _ 10 dollar bills _ 5 dollar bills _ 1 dollar bills _ quarters _ nickels, dimes, pennies, etc.
so far i got this:
import java.util.Scanner;
public class Cashier { //***************************************************************** // Creates change to be given to customer from cashier. //***************************************************************** public static void main(String[] args) { double a; double b;
Scanner scan = new Scanner (System.in); System.out.print ("Enter total amount:$ "); a = scan.nextDouble();
System.out.print ("Enter amount given:$ "); b = scan.nextDouble();
System.out.print ("Change:$" + (b - a) );
} }
First, before you do any programming, grab a piece of paper and plan what you think should happen.
You need to devise an algorithm to give theleast number of coins when you get change from a note.
When you've got that then we shall sort out your program. :eek: