Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

01- Read phone numbers input by the user, one per line, without giving a prompt. When the input line is quit, stop accepting input. As

image text in transcribed
01- Read phone numbers input by the user, one per line, without giving a prompt. When the input line is quit, stop accepting input. As output, print the phone numbers with area code 416, each on a separate line. The phone numbers are all in one of these two forms: AAA-XXX-XXXX o r XXX-XXXX where AAA is the area code, and XXX-XXXX is the rest. If AAA is missing, it is assumed to be 416; in your program, dene 416 as a named value rather than using it as a magic number (that is, create a variable whose value is "416\" and use this variable rather than repeatedly using the literal \"416"). When producing output, add 416 to phone numbers whose area code is missing. Requirements: . Use ordinary string operations (not regular expressions) to work with the phone numbers. . You should have a function that returns true or false depending on whether the area code of a phone number matches

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions