Create a new Java application called “PhoneNumberConversion” (without

Problem 2:

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 called Business, P 2.23 on page 75, in the section on Programming Exercises near the end of Chapter 2, before the answers to the self-check questions.

Request the ten-digit phone number from the user at the command line.

 

Below is the Hortsmann textbook chapter 2 programming exercise called Business, P 2.23 on page 75:

•• business p2.23

The following pseudocode describes how to turn a string containing a ten-digit phone number (such as “4155551212”) into a more readable string with parentheses and dashes, like this: “(415)­555-1212”.

Take the substring consisting of the first three characters and surround it with “(” and “) “. This is the area code.

Concatenate the area code, the substring consisting of the next three characters, a hyphen, and the substring consisting of the last four characters. This is the formatted number.

Translate this pseudocode into a Java program that reads a telephone number into a string variable, computes the formatted number, and prints it.

Problem 3:

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 “StringLength” (without the quotation marks) that requests a String from the user at the command line and finds its length. Your program should output: “Your string has a length of X characters.” where X is the String’s length.  Allow for the String to be one or more words of input.  Be sure to use the suitable method for determining the length of the String.

#Create #Java #application #called #PhoneNumberConversion

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions