Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please make sure outputs match To make telephone numbers easier to remember, some companies user letters to show their telephone number. For example, using letters,

image text in transcribed
image text in transcribed
please make sure outputs match
To make telephone numbers easier to remember, some companies user letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example 225-5466 can be displayed as CALL HOME, which uses eight letters. Write a Java program that prompts the user to enter a telephone number expressed in letters and outputs the corresponding telephone number in digits. If the user enters more that seven letters (spaces do not count), then process only the first seven letters and ignore the rest. Your program should also output the - Chyphen) after the third digit. Allow the user to use uppercase and lowercase letters, as well as spaces between the words. Hint1: You can use the chart method of the class String to extract each character. For example, if str refers to your String, then the expression str.charAt(0) returns the character at the ith position. Recall that in a String, the position of the first character is 0. Hint2: You can use the toUpperCase or to LowerCase method of the dass String to convert all chars in the String to upper or lower. Hint3: Number Letter none none ABC DEF GHI GHI JKL MNO PQRS 8 TUV WXYZ If the user enters: Get Loan Your program will output: 438-5626 Or, if the user enters: cAll Home Your program will output: 225-5466 Your prompt to the user should be: Please enter a telephone number using letters: Please note that your class should be named Telephone Number

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

2. Be tactful, but dont avoid talking about tough issues.

Answered: 1 week ago