Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Writing a program on xcode with C++ that promotes the user to enter a telephone number in the format ddd-ddd-dddd, where d is a digit

Writing a program on xcode with C++ that promotes the user to enter a telephone number in the format ddd-ddd-dddd, where d is a digit [0-9]. This is the format for telephone numbers in North America.

Test that the input is in the correct format and further check if the phone number has a Canadian area code. The program will report if the input is valid or not. If the input includes a Canadian area code, the program will display the name of the province or territory with that area code. The program will continue to process numbers until the user enters the letter q.

Province / Territory Codes (italics not yet active)
Alberta 368, 403, 587, 780, 825
British Columbia 236, 250, 604, 672, 778
Manitoba 204, 431, 584
New Brunswick 506, 428
Newfoundland and Labrador 709, 879
Northwest Territories 867
Nova Scotia 782, 902
Nunavut 867
Ontario 226, 249, 289, 343, 365, 382, 387, 416, 437, 519, 548, 613, 647, 683, 705, 742, 753, 807, 905, 942
Prince Edward Island 782, 902
Quebec 263, 354, 367, 418, 438, 450, 468, 514, 579, 581, 819, 873
Saskatchewan 306, 474, 639
Yukon 867

your C++ program source file (likely .cpp extension)

your log file (hercules) or screenshot (Visual Studio, XCode, etc.) that demonstrates your program's output, using the following inputs:

306-555-5555 (from Saskatchewan)

416-123-4567 (from elsewhere in Canada)

305-555-5323 (valid format, not from Canada)

42 (not valid)

hello (not valid)

q (quit)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions