Data Structures, Algorithms, & Applications in C++
Chapter 1, Exercise 15

(a)
The data member dollar is of type long. The maximum value assignable to a variable of type unsigned long is 2^{32} - 1. The maximum allowable value for cents is 99. Therefore, when the representation of Program 1.13 is used, the maximum permissible currency value is 2^{32} - 1 dollars and 99 cents.
Since we store the sign seprately, the minimum currency value is just the negative of the maximum value.

(b)
The maximum value assignable to a variable of type int is 2^{31} - 1. The maximum allowable value for cents is 99. When the data type of dollars and cents is changed to int, the maximum permissible currency value is 2^{31} - 1 dollars and 99 cents.
Since we store the sign seprately, the minimum currency value is just the negative of the maximum value.

(c)
To avoid an error in the conversion, the result (a1 and a2) should not exceed MAX_VALUE = 2^{32}-1. Therefore, the dollar amount should not exceed MAX_VALUE / 100. Even though the dollar amount may not exceed MAX_VALUE / 100, the method may not give the correct result. To assure a correct result, the sum of the dollar amounts should not exceed MAX_VALUE / 100.