Programming Exercises

1:Modify the Tv and Remote classes as follows:
  1. Make them mutual friends.

  2. Add a state variable member to the Remote class that describes whether the remote control is in normal or interactive mode.

  3. Add a Remote method that displays the mode.

  4. Provide the Tv class with a method for toggling the new Remote member. This method should work only if the Tv is in the on state.

Write a short program testing these new features.

2:Modify Listing 14.10 so that hmean() throws an exception of type hmeanexcp and gmean() throws an exception of type gmeanexcp. Both of these exception types are to be derived from the exception class. Also, upon catching an hmeanexcp exception, the program should prompt for a new data pair and continue, while ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.