Implement the Coin class described in Section 8.2. Modify the CashRegister class so that coins can be added to the cash register, by supplying a method

void enterPayment(int coinCount, Coin coinType)

The caller needs to invoke this method multiple times, once for each type of coin that is present in the payment.

Complete the following files:

CashRegister.java

CashRegisterTester2.java

Coin.java

Use the following file:

CashRegisterTester.java

/**
   This program tests the CashRegister class.
*/
public class CashRegisterTester
{
   public static void main(String[] args)
   {
      final double NICKEL_VALUE = 0.05;
      final double DIME_VALUE = 0.1;
      final double QUARTER_VALUE = 0.25;

      CashRegister myRegister = new CashRegister();
      myRegister.recordPurchase(0.82);
      myRegister.enterPayment(3, new Coin(QUARTER_VALUE, "quarter"));
      myRegister.enterPayment(2, new Coin(NICKEL_VALUE, "nickel"));
      
      double myChange = myRegister.giveChange();
      System.out.println("Change: " + myChange);
      System.out.println("Expected: 0.03");
   }
}