This question has been answered
Question

im looking to understand the problem so I can solve similar ones in the future since im very confused

This section in the book is called Character Operations is very confusing for me and this is the question im presented with:


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:

Alphabetic at 1

Hint: Use two if statements to check each of the two characters in the string, using Character.isLetter(). 


import java.util.Scanner;


public class FindAlpha {

  public static void main (String [] args) {

   Scanner scnr = new Scanner(System.in);

   String passCode;


   passCode = scnr.next();


   /* Your solution goes here */


  }

}

Answered by Expert Tutors
Step-by-step explanation
1 Attachment
Capture.PNG
PNG
The student who asked this found it Helpful
Overall rating 100%
im looking to understand the problem so I can solve similar ones in the future since im very confused This section in the book is called Character...
Get unstuck

372,107 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses