1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KiRa [710]
3 years ago
11

Write code to print the location of any alphabetic character in the 2-character string passCode. Each alphabetic character detec

ted should print a separate statement followed by a newline.
Ex: If passCode is "9a", output is:

Alphabetic at 1
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 */
}
}
Computers and Technology
1 answer:
Mars2501 [29]3 years ago
5 0

Answer:

for (int i=0; i<passCode.length(); i++) {

           if ((passCode.charAt(i) >= 65 && passCode.charAt(i) <= 90) || (passCode.charAt(i) >= 97 && passCode.charAt(i) <= 122)) {

               System.out.println("Alphabetic at " + i);

           }

}

Explanation:

The rest of the code should be as above.

In order to check if the character is alphabetic or not, we need to use ASCII table. Characters are represented as integers in the ASCII table. For example "a" equals 97, "A" equals 65.

Then all we need to is to check if the character value in ASCII is in alphabetic ranges. If it is, print the index of the character.

You might be interested in
Take some time to do some research about small businesses in your area. Select one and using HTML design a simple site that educ
lina2011 [118]

Answer:

All you have to do is whright about it

Explanation:

3 0
2 years ago
Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
Oduvanchick [21]

num = int(input("Enter a number: "))

i = 2

while num > 1:

   if num % i == 0:

       num = num / i

       print(i, end=" ")

       i = 2

   i += 1

I hope this helps!

8 0
2 years ago
Lil fun question : burgers or pizza??
Margarita [4]
Pizza. . . . . . . . . . .
6 0
2 years ago
Read 2 more answers
Application area of word processor?​
kompoz [17]

Answer:

  1. Typing, editing,and printing different types of document .
  2. Formatting text, paragraph , pages for making attractive document .
  3. Checking spelling and grammar of document for making it error free.
  4. Inserting and editing pictures , objects, etc.
  5. Adding watermark , charts , quick flip, etc.
7 0
3 years ago
Read 2 more answers
When creating a study schedule, why is it important to be realistic about how much time everything requires?
postnew [5]

Answer:

It makes it easier for you to pass you end goal

6 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following savings vehicles usually requires a high minimum balance? ASimple savings account BCertificate of Deposit
    7·1 answer
  • Im being timed please help!!
    7·2 answers
  • In Alphatech Systems, email software screens incoming messages by organizing them into mailboxes and identifying junk mail. As a
    13·1 answer
  • What is the cell reference for the cell located in the second column and fifth row of a worksheet?
    9·1 answer
  • This problem has been solved!
    8·1 answer
  • How do you mark peoples answer as the brainliest answer? I have trouble doing so. Please help!
    10·2 answers
  • What are listed in the vertical columns across the top of the Event Editor?
    5·2 answers
  • Que es tarjeta madre resumen porfa
    13·2 answers
  • A computer reads a sequence from top to bottom and left to right.
    13·1 answer
  • Difference between electrical and electronic devices
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!