
Chapter 12: Prelab Assignment
Classes and Abstraction | 287
Name __________________________________________ Date _______________________
Section _________________________________________
Use program Money for these exercises.
// Program Money manipulates instances of class Money.
#include <iostream>
using namespace std;
class Money
{
public:
void Initialize(long dollars, long cents);
// Initializes dollars and cents
// Knowledge responsibilities
long GetDollars() const;
// Returns dollars
long GetCents() const;
// Returns cents
// Action responsibilities
Money Add(Money otherMoney) const;
// Returns result of adding self to otherMoney
private:
long dollars;
long ...