Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that inputs a ten-digit phone number, and then turns that ten- digit phone number into a more readable string with a

Write a Java program that inputs a ten-digit phone number, and then turns that ten- digit phone number into a more readable string with a pair of parentheses, a dash, and a space.

For example, if the user enters the value 5147447500 as input, your program should print the string (514) 744-7500.

Hint use integer division and integer remainder operations to compute the three required blocks of numbers: area code 514, prefix 744, and line number 7500.

For example, in Java, 5147447500L/ 10000000 is equal to 514.

A sample run of your program should produce the following output, where the users input is shown inredfor clarity:

Enter a 10-digit phone-number: 5147447500

area code:514

prefix : 744

line number: 7500

PhoneNumber:(514) 744-7500

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

Question

=+employee to take on the international assignment?

Answered: 1 week ago