Answered step by step
Verified Expert Solution
Link Copied!

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

  • image text in transcribed 

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Operating System questions

Question

Use MATLAB to calculate the following integrals: (a) (b) cos(x)e dx

Answered: 1 week ago