Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help WITHOUT using the array function - using JAVA To make telephone numbers easier to remember, some companies user letters to show their telephone

Please help WITHOUT using the array function - using JAVAimage text in transcribed

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 - (hyphen) 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 charAt method of the class String to extract each character. For example, if str refers to your String, then the expression str.charAt(i 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 toLowerCase method of the class String to convert all chars in the String to upper or lower. If the user enters: Get Loan Your program will output: 438-5626

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions