In: Computer Science
Write pseudocode for a function that translates a telephone number with letters in it (such as 1-800-FLOWERS) into the actual phone number. Use the standard letters on a phone pad
Take the first character.
Covert A, B, and C to 2,
D, E, and F to 3,
G, H, and I to 4,
J, K, and L to 5,
and M, N, and O to 6,
P, Q, R, and S to 7,
T, U, and V to 8,
and W, X, Y, and Z to 9 .
CODE:
Initialize actual phone number to the empty string
For each character in the phone number
If the character is A, B or C
Append a 2 to the end of actual phone number
Else if the character is D, E or F
Append a 3 to the end of actual phone number
Else if the character is G, H or I
Append a 4 to the end of actual phone number
Else if the character is J, K or L
Append a 5 to the end of actual phone number
If the character is M, N, O
Append a 6 to the end of actual phone number
Else if the character is P,Q,R,S
Append a 7 to the end of actual phone number
Else if the character is T,U,V
Append a 8 to the end of actual phone number
Else if the character is W,X,Y,Z
Append a 9 to the end of actual phone number
---------------------------------------------------Please Upvote-----------------------------------------------------------------------