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]
4 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]4 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
Patient letters created from __________ use structured data and do not require a large amount of typing from the medical assista
umka2103 [35]
Templates I think. not sure
3 0
3 years ago
Free response: Spot and Fix the Bug Respond to the following questions about your investigation into the bug with the counting g
Pepsi [2]

Answer:

Hello Dear,

The question doesn't have any code in it.

Please elaborate or expedite your question.

Explanation:

Please share the code file which is usually having an extension of .org.

3 0
4 years ago
If you want a relatively broad, unbiased overview of a subject you should consult a/an ?
tekilochka [14]

To find a relatively broad unbiased overview of a subject in a specific field of study, it would be best to consult a: encyclopedia.
8 0
3 years ago
Read 2 more answers
What is a placeholder for a piece of information that can change is called?
uranmaximum [27]

Answer:

Variable.

Explanation:

A placeholder for a piece of information that can change is called variable.

In Computer programming, a variable stores information which is passed from the location of the method call directly to the method that is called by the program.

For example, they can serve as a model for a function; when used as an input, such as for passing a value to a function and when used as an output, such as for retrieving a value from the same function.

Hence, when you create variables in a function, you can can set the values for their parameters.

For instance, to pass a class to a family of classes use the code;

\\parameter Name as Type (Keywords) = value;

\\procedure XorSwap (var a,b :integer) = "myvalue";

5 0
3 years ago
Which one of the following sstatements suggests a good method
PilotLPTM [1.2K]
The 2nd onnnnneeeeeee
7 0
3 years ago
Other questions:
  • While visiting a web site during your lunch break, you see a window that states the web site will not operate properly without f
    13·1 answer
  • Select the correct answer. Andy wants to become a multimedia producer. Which degree can help him achieve this goal? A. bachelor’
    5·1 answer
  • In GIMP, the ( ) displays the image that the user is currently working on
    12·1 answer
  • Assignment 3: Chatbot
    11·2 answers
  • Engineers and scientists redesign a prototype if it does not work correctly true or false and why
    10·2 answers
  • All of the following are strategies to help you prepare for standardized test except <br>​
    5·1 answer
  • Mrs. Sims polled her students about which social media app they use most. Which type of chart would best display this data?
    9·1 answer
  • The formula for calculating your BMI is below. BMI=703weight in pounds(height in inches)2 Which line of code will correctly calc
    8·1 answer
  • An individual involved with the aspect of a project will be concerned with budgets and the costs associated with running a busin
    10·2 answers
  • Which shortcut keys can be used to duplicate a slide?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!