Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Write a program named LastNamePhone that asks the user for their phone number in the form XXX-XXX-XXXX, and determines whether or not the
2. Write a program named LastNamePhone that asks the user for their phone number in the form XXX-XXX-XXXX, and determines whether or not the number is real (not enough or too many digits) or if it matches any of the numbers from the movies (middle 3 digits 555). In addition, check that they put in the -'s in the correct locations. Let the user know why it isn't a number if it isn't a number. (Bonus if you also check to make sure each group of 3 or 4 numbers is actually numbers). Examples: Enter your phone number: 123-456-7890 That is a legit number! Enter your phone number: 123-555-1234 That is a number from a movie!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
include include include usingnamespacestd boolisValidPhoneNumberconststringphone...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started