Question 2: Write a java program that prompt the user for a string telephone number of the form ddd-dddd-dddd, where d is a digit. If the phone number is less than 11 digits, print on the screen "wrong number". Extract and print out the area code (the first 3 digits) then displays the phone number in the following format: (ddd) dd-dd- dddd.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

hey there i need this asap, Write code and also attach code running screenshot. Thanks.
Thumbs up will be gurrented

Question 2: Write a java program that prompt the user for a string telephone
number of the form ddd-dddd-dddd, where d is a digit. If the phone number is less than
11 digits, print on the screen "wrong number". Extract and print out the area code (the
first 3 digits) then displays the phone number in the following format: (ddd) dd-dd-
dddd.
Transcribed Image Text:Question 2: Write a java program that prompt the user for a string telephone number of the form ddd-dddd-dddd, where d is a digit. If the phone number is less than 11 digits, print on the screen "wrong number". Extract and print out the area code (the first 3 digits) then displays the phone number in the following format: (ddd) dd-dd- dddd.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning