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
-
A Company has sold $5,000 worth of merchandise for cash, and a 5% sales tax is in effect. Prepare the entry to record the sale. Account Title Record the entry made when the company remits the sales...
-
@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 and verify the solution. a. b. + (1.08)4= $850 1.083
-
On January 1, 2011, Ithaca Corp. purchases Cortland Inc. bonds that have a face value of $150,000. The Cortland bonds have a stated interest rate of 6%. Interest is paid semiannually on June 30 and...
-
Identifying cost flows in process cost system} List in columnar form the transactions and the accounts debited and credited to reflect the flow of costs through a process cost accounting system for...
-
Mark Landman's accountant resigned and left the books in a mess. Mark is trying to compute unknown values in inventory accounts in three of his stores. Knowing of your expertise in cost flows, he...
-
The ledger of the Wildhorse Company at the end of the current year shows Accounts Receivable of $ 2 2 3 , 0 0 0 . ( a ) If Allowance for Doubtful Accounts has a credit balance of $ 4 , 4 0 0 in the...
-
! Required information Problem 16-8 (Algo) Multiple differences; taxable income given; two years; change in tax rate; financial statement effects [LO16-1, 16-2, 16-3, 16-5, 16-6, 16-8] [The following...
-
The engine block of a small electric generator gets very hot during operation. It is needed to remove as much heat as possible from the top surface of the block while keeping its temperature at a...
-
Analyse the role of the CEO of McDonalds in creating a new strategic plan and corporate objectives for the company.
-
Where does the numbers for EBIT (Recession, Normal, Boom) come from. The income statement says that income before income taxes is 18,999, so where does it normal (21,000,000,000) comes from? From...
-
Assessment of physical and technical safeguards in place to protect health information from any type of threat. Evaluation criteria for the assessment should include the following: Initial phase...
-
A thin rod extends from x = 0 to x = 15.0 cm. It has a cross-sectional area A = 7.50 cm, and Its density increases uniformly in the positive x-direction from 2.00 g/cm at one endpoint to 19.5 g/cm at...
-
Raintree Cosmetic Company sells its products tocustomers on a credit basis. An adjusting entry for bad debtexpense is recorded only at December 31, the company's financialyear-end. The 2012 stateme 2...
-
For the data in Exercise 17-19, use the FIFO method to summarize total costs to account for, and assign these costs to units completed and transferred out, and to units in ending work in process....
-
What events encouraged managers to seek means to address the human influence on work?
-
Prepare budgeted income statement (Learning Objective 2) Wheels is an exotic car dealership. Suppose its Miami office projects that 2009 quarterly sales will increase by \(3 \%\) in Quarter 1, by...
-
How does the professionalization of healthcare personnel influence this situation?
Study smarter with the SolutionInn App