In How To Sec 4.1 on page 146, we represented the state of the vending machine by storing the balance in pennies. This is ingenious, but it is perhaps not the most obvious solution. Another possibility is to store the number of dollars that the customer inserted and the change that remains after giving out the first class stamps. Reimplement the vending machine in this way. Of course, the public interface should remain unchanged.

Complete the following file:

Use the following file:

import java.util.Scanner;

public class StampMachineTester
   public static void main(String[] args)
      StampMachine machine = new StampMachine();
      System.out.print("First class stamps: "); 
      System.out.println("Expected: 2");
      System.out.print("Penny stamps: "); 
      System.out.println("Expected: 12");