Chapter 2: Programming: Telephone Numbers with PDT and ADT

Chapter 2: Objects and Primitive Data Types

  1. Write a java application, TelephoneNumV1_YI.java that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first three digits contain an 8 or 9 (but don’t be more restrictive than that), and make sure that the second set of three digits is not greater than 742.
    Hint: Think through the easiest way to construct the phone number. Each digit does not have to be determined separately.

  2. Write an Object Oriented Application, TelephoneV2_YI.java with the same functionality as the previous version but using Object Oriented Design.