Canadian phone number has the following format: +1 (NPA) NXX-XXXX Country Area Code Code Prefix Subscriber...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Canadian phone number has the following format: +1 (NPA) NXX-XXXX Country Area Code Code Prefix Subscriber Area Code Three digits starting with 2-9 Prefix= Three digits starting with 2-9 Subscriber= Any four digits 0-9 Write a java program, using loops, that asks the user to enter a phone number then if correct print the Area Code, Prefix, and Subscriber numbers. If not correct, print what is wrong. Sample run: Enter a number or -99 to quit: +1 (604) 277-9999 The number is correct with area code: 604, prefix 277, and subscriber 9999 Enter a number or -99 to quit: 1 (104) 277-0123 Country code doesn't start with + and area code doesn't start with a 2-9 number. Enter a number or -99 to quit: 1 (104) 177-7634 Country code doesn't start with + and area code and prefix don't start with a 2-9 number. Enter a number or -99 to quit: +2 (104) 166-9876 Country code is not 1 and area code and prefix don't start with a 2-9 number. Enter a number or -99 to quit: +2 (104) 777-3377 Country code is not 1 b and area code doesn't start with a 2-9 number Enter a number or -99 to quit: +2 (604) 177-2854 Country code is not 1 b and prefix doesn't start with a 2-9 number. Enter a number or -99 to quit: +1 (604) 277-12345 Subscriber number is more than 4 digits Enter a number or -99 to quit: -99 The program is ending Canadian phone number has the following format: +1 (NPA) NXX-XXXX Country Area Code Code Prefix Subscriber Area Code Three digits starting with 2-9 Prefix= Three digits starting with 2-9 Subscriber= Any four digits 0-9 Write a java program, using loops, that asks the user to enter a phone number then if correct print the Area Code, Prefix, and Subscriber numbers. If not correct, print what is wrong. Sample run: Enter a number or -99 to quit: +1 (604) 277-9999 The number is correct with area code: 604, prefix 277, and subscriber 9999 Enter a number or -99 to quit: 1 (104) 277-0123 Country code doesn't start with + and area code doesn't start with a 2-9 number. Enter a number or -99 to quit: 1 (104) 177-7634 Country code doesn't start with + and area code and prefix don't start with a 2-9 number. Enter a number or -99 to quit: +2 (104) 166-9876 Country code is not 1 and area code and prefix don't start with a 2-9 number. Enter a number or -99 to quit: +2 (104) 777-3377 Country code is not 1 b and area code doesn't start with a 2-9 number Enter a number or -99 to quit: +2 (604) 177-2854 Country code is not 1 b and prefix doesn't start with a 2-9 number. Enter a number or -99 to quit: +1 (604) 277-12345 Subscriber number is more than 4 digits Enter a number or -99 to quit: -99 The program is ending
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
@M zain do not respond to this question again!!! You need to stop posting ridiculous solutions to my question. You literally respond in seconds after this question that I post with crazy weird...
-
Assume that you have an algorithm that can fill 3D triangles with a constant colour. Explain what additional information and additions to the algorithm are required to Gouraud shade the triangles....
-
The two roots of a quadratic equation ax 2 + bx + c = 0 can be obtained using the following formula: b 2 - 4ac is called the discriminant of the quadratic equation. If it is positive, the equation...
-
Solve the following equations for x to five-figure accuracy 2x a. 1 +0.13 +41 +0.13 X 365 $831 ) 1 0.13 x20.13 x 59 $831 b. 3x(1.035) +++-$2500 1.033
-
John Grant is chairman of the board of The Grant Group Ltd. Suppose Grant has just founded this company, and assume that he treats his home and other personal assets as part of The Grant Group....
-
What factors should companies consider when they are choosing a risk management strategy?
-
Presented below are selected ledger accounts of Woods Corporation at December 31, 2012. Woods??s effective tax rate on all items is 34%. A physical inventory indicates that the ending inventory is...
-
Using the information below, prepare a bank reconciliation and cash at bank ledger reconciliation for Vera Limited as at 31 January 2022. 1. The balance on the bank statement at 31 January 2022 is...
-
What governance mechanisms and policy instruments are effective in promoting sustainability transitions at local, regional, and global scales, considering the diverse interests and priorities of...
-
In what ways do emergent health crises and geopolitical tensions, such as pandemics and trade disputes, serve as unforeseen change accelerators, prompting organizations to reassess risk management...
-
Which type of groups can make up a 'care network' for consumers?
-
When deciding the best strategy to add extra time on a project, we should consider an approach that considers the cost of overtime the amount of time to be reduced lighting requirements work morale...
-
In fact, there are numerous ways in which generative artificial intelligence (AI) and workplace monitoring systems can aid in the development of resilient personnel: 1. Generative AI can create...
-
Assume a manufacturing company provides the following information from its master budget for the month of May: Unit sales 7 , 4 0 0 Selling price per unit $ 5 3 Direct materials cost per unit $ 2 0...
-
What has diversification of the news media done?
-
In Problems 718, write the augmented matrix of the given system of equations. f0.01x0.03y = 0.06 [0.13x + 0.10y = 0.20
-
There are three general categories of capital budget scenarios: replacement, expansion, and investment in a NewCo. Describe the overall decision-making context for each. How do they draw on similar...
-
The overall process of creating a capital budget proposal has a lot of similarities to writing a business plan for a start-up company. Describe three aspects of the similarities between a budget...
-
In analysis, some focus seems to be on the need for NPV equations to be applied to projects that are mutually exclusive. But in practice we find that the lines are blurred in capital budgeting....
Study smarter with the SolutionInn App