Question
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "PhoneNumberConversion" (without the quotation marks) based on the Horstmann textbook chapter 2 programming exercise, Business, p 2.23.
Request the ten-digit phone number from the user at the command line.
Output should prints string 10 numbers into form (XXX) XXX - XXXX <------ I can't figure this part out.
-------------------------------------------------------------------------------------------------------
My code:
package phonenumberconversation; import java.util.Scanner; public class PhoneNumberConversation {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter ten-digit phone number: "); String pk = sc.next(); System.out.println("Your phone number is "+pk); // TODO code application logic here } }
---------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started