Write code to print the location of any alphabetic character in the 2-character string passCode. Each alphabetic character detected should print a separate statement followed by a newline. Ex: If passCode is "9a", output is:

Respuesta :

Answer:

//Program written in Java Programming Language

// Comments are used for explanatory purpose

import java.util.Scanner; //Scanner Library Imported

public class findloc { //Program Class Declared

public static void main (String [] args) {//Program Main Method

Scanner input = new Scanner(System.in);

string passCode; // Declare string passCode

passCode = Input.next();//Input Passcode

if(Character.isLetter(passCode.charAt(0)))//Check Alphabet Position

{

System.out.println("Alphabetic at 0");//Print Alphabet position is at 0

}

if(Character.isLetter(passCode.charAt(1))) //Check Alphabet Position

{

System.out.println("Alphabetic at 1");//Print Alphabet position is at 1

}

}

}