Random Phone Number

Meta

  • Author: Mailee Chue

Part 1

Write a program that will only accept 11 digits from (0-9) from the user (Hint: use a loop).

  1. If digits are not between (0-9): input is invalid, and the user must reenter a valid number.
  2. The first three number will be store in areaCode
  3. The next three will be store in nextThree
  4. The last four will be store in lastFour
  5. First print:

    “A Random Phone Number: (###)###-#####”

Part 2

Now take the first number, middle number, and last number from the digits inputed by the user and label it as a new variable called officeNumber.

Example:

1 3 4 8 7 8 0 9 3 8 4 ——> 184 is the officeNumber.

Part 3

Finally, print:

“The random number (###)###-####, belongs to the professor whose office number is ### at El Paso Community College.”