1 import java.util.Scanner;
2
3 /**
4 This program simulates a transaction in which a user pays for an item
5 and receives change.
6 */
7 public class CashRegisterSimulator
8 {
9 public static void main(String[] args)
10 {
11 Scanner in = new Scanner(System.in);
12
13 CashRegister register = new CashRegister();
14
15 System.out.print("Enter price: ");
16 double price = in.nextDouble();
17 register.recordPurchase(price);
18
19 System.out.print("Enter dollars: ");
20 int dollars = in.nextInt();
21 System.out.print("Enter quarters: ");
22 int quarters = in.nextInt();
23 System.out.print("Enter dimes: ");
24 int dimes = in.nextInt();
25 System.out.print("Enter nickels: ");
26 int nickels = in.nextInt();
27 System.out.print("Enter pennies: ");
28 int pennies = in.nextInt();
29 register.enterPayment(dollars, quarters, dimes, nickels, pennies);
30
31 System.out.print("Your change: ");
32 System.out.println(register.giveChange());
33 }
34 }