// In-class assignment 7 - Change Class
//
// The Change class represents the amount of change in coins
// in your pocket or bag. It provides a Set() function to set
// the amount of change and a Value() funtion to calculate the
// value of your change.
//
// 1. Write a driver (main() function) to test this class.
//    It should declare a Change object, set the change to
//    something, and then print the value of the change.
//
// 2. Write a constructor function for this class that allows
//    the client programmer to specify an initial value for
//    change objects when they are declared. Then modify your
//    driver program to test your constructor.

class Change
{
private:
   int numPennies;
   int numNickels;
   int numDimes;
   int numQuarters;

public:
   void Set( int pennies, int nickels, int dimes, int quarters )
   {
      if (pennies < 0 || nickels  < 0 ||
	  dimes   < 0 || quarters < 0)
      {
	 numPennies  = 0;
	 numNickels  = 0;
	 numDimes    = 0;
	 numQuarters = 0;
      }
      else
      {
	 numPennies  = pennies;
	 numNickels  = nickels;
	 numDimes    = dimes;
	 numQuarters = quarters;
      }
   }

   int Value()
   {
      return numPennies + numNickels * 5 +
	     numDimes * 10 + numQuarters * 25;
   }
};
