 |
|

Given the following class definition for a Money object:
class Money
{
private:
int dollars;
int cents;
public:
void setValue(int d, int c);
void addValue(int d, int c);
};
void Money::setValue(int d, int c)
{
dollars = d;
cents = c;
}
How could we implement addValue so that if we add a new dollar and cent amount we update the dollar amount appropriately in case we have over 99 cents? That is, the number of cents after adding should never be more than 99. |
 |
| |
|
|
 |