Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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')) 11

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

Students also viewed these Databases questions