Hi there! I'm a beginner at
java and I am completely lost at this! I'm trying to pass this class and I need massive help with programs! Can someone please help me with this? I HAVE NO IDEA HOW TO DO THIS!!!
1.) Before each significant step, provide a comment explaining the step (do not comment
every line of code).
2.) The input is a
String. It is recommended you immediately convert this String to
uppercase since 1-800-flowers and 1-800-FLOWERS would both display 1-800-
3569377 as the phone number.
3.) You MUST use a for-loop to step through phoneNumberStr.
4.) Within the for-loop body, convert only the letters to their equivalent number using the
following algorithm:
a. If the current character of phoneNumberStr is an uppercase letter, call the
method getNumber to determine the number and append (or concatenate) to
phoneNumber. Note that to check if the character is a letter consider the
ASCII range of uppercase letters.
For example, if(phoneNumberStr.charAt(i) == 65) is true when the character
at index i is A.
Also, recall that when considering characters use single quotes – ‘A’
b. If the current character of phoneNumberStr is NOT a letter, you will need to
create a one-character substring and then append/concatenate this substring to
phoneNumber
c. Output the phoneNumber
5.) Include appropriate hypens to the actual phone number.
That is, 1-800-flowers or 1800FLOWERS would display the phone number as
1-800-356-9377
Thanks for your time!!!