Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete the program by providing the additional if-else branches for decoding other letters in a phone number. Try incrementally writing the program by adding one
Complete the program by providing the additional if-else branches for decoding other letters in a phone number. Try incrementally writing the program by adding one "else if" branch at a time, testing that each added branch works as intended.
1 import java.util.Scanner 3 public class PhoneNumberDecoder t 4 public static void main(String[] args) t Scanner scnr new Scanner(System.in); String phoneStr; I/ User input: Phone number string int i char currChar; 7 / Current index in phone number string // Current char in phone number string System.out.println("Enter phone number: "); phonest r scnr.next(); 10 12 13 14 15 System.out.print("Numbers only: "); for (0; i , phoneStr.Length();) { // For each element currChar phoneStr.charAt(i); 17 System.out.print(currChar); // Print character as is 19 20 21 else if ( ( (currChar >= ((currChar'A')&&(currChar 'C'))) 'a') && (currChar c')) 11Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started