SOURCE FILE: ex0516.cpp


// Example 5.16. Program to test money class   
   
#include <iostream.h>
#include "money.h"
   
int main(void)   
{
   money MyAmount(27, 33);
   money YourAmount(10.125);

   cout << "My amount of money is $";
   MyAmount.display();
   cout << ", and your amount of money is $";
   YourAmount.display();
   cout << ".\n";
  
   cout << "I have " << MyAmount.quotient(YourAmount) 
        << " times as much money as you have.\n";
   
   MyAmount.AddTo(YourAmount);
   cout << "If I get an amount equal to yours, I now have $";
   MyAmount.display();
   cout << ".\n";

   MyAmount.MultiplyBy(1.06);
   cout << "If 1.06 is multiplied by my money, I now have $";
   MyAmount.display();
   cout << ".\n";
   
   cout << "My amount of money is ";
   if (MyAmount.LessThan(YourAmount))
      cout << "less than yours.\n";
   else
      cout << "more than yours.\n";
   
   cout << "My amount of money is ";
   if (MyAmount.EqualTo(YourAmount))
      cout << "equal to yours.\n";
   else
      cout << "not equal to yours.\n";
      
   MyAmount.AssignMoney(594, 25);
   cout << "After reassigning money, I have $";
   MyAmount.display();
  
   YourAmount.AssignMoney(4932.286);
   cout << ", and you have $";
   YourAmount.display();
   cout << ".\n";

   return 0;
}