Chapter 12-6 PG. 639 Solution



Design, implement, and test a class that represents a phone number. The number should be represented by a country code, an area code, a number, and a type. The first three values can be integers. The type member is an enumbberation of HOME, OFFICE, FAZ, CELL, and PAGER. The class should provide a default constructor that sets all of the integer values to zero and the type of HOME. A constructor that enables all values to be set should be provided as well. You also should provide a constructor that takes just the number and type as arguments, and sets the country and area codes to those of your location. The class will have observers that enable each data member to be retrieve, and transformers that allow each data member to be changed. An additional observer should be provided that compares two phone numbers for equality.
Powered by