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
Options to rotate cells in excel are available using the _____ button in the alignment group on the home tab.
7nadin3 [17]
Options to rotate cells in excel are available using the orientation button in the alignment group on the home tab. orientation.
7 0
3 years ago
It is believed that Taiwan is the original home of these early Oceania explorers. Maori Lapita Polynesians Aborigines
Lena [83]
The answer is Lapita.
Lapita is a prehistoric culture of people from c. 1600 BCE to c. 500 BCE in the Pacific Ocean. It is believed that they are the ancestors of other historic cultures such as Polynesia and Micronesia.  Scholars assumed the origin of the Lapita is from Austronesians from Taiwan. The domesticated spread farther into Ocenia.
5 0
3 years ago
Read 2 more answers
How do you change your username
Rasek [7]

Answer:

Google it, I can't send links, but the brainly faq link should show up

3 0
3 years ago
Read 2 more answers
Who is the primary audience for demonstrations of game prototypes made by the developer?
padilas [110]

Answer:

the tester

Explanation:

When a video game is playable the first audience to test these prototypes are the tester, these people have to test all the game, and they have say all the information about errors, issues, bugs, and any difficulty to resolve these problems in a final video game's version, in this way the complete game arrives to the final audience.

5 0
3 years ago
When making an assembly of design what command is most.commonly used?
Schach [20]
There are two common command lines used in creating design assembly. The 'push' and 'pull' command. Both allows you to get parts from the original predelivered content's source desgian    and recreate the design faster and with less memory.
6 0
3 years ago
Other questions:
  • Can i earn money at weegy.com ?
    10·1 answer
  • 50 points!!!!!
    9·2 answers
  • ​if a primary key combines two or more fields, then it is called a _____.
    14·1 answer
  • Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their chec
    9·2 answers
  • Use the Windows ________ to check on a nonresponsive program. Select one: A. Backup utility B. Task Manager C. System Restore D.
    10·1 answer
  • Jeremy has created a document that has images and a chart. The chart has to be updated manually, and double-clicking on the char
    15·1 answer
  • Explain the role of a computer in education​
    9·1 answer
  • 2. The internet offers a great source of information; however, how are
    9·1 answer
  • Difference between switch and switch lite
    10·1 answer
  • We can save our data peremently on a
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!