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
LenKa [72]
3 years ago
10

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 Hint: Use two if statements to check each of the two characters in the string, using Character.isLetter().
Computers and Technology
1 answer:
serg [7]3 years ago
5 0

Answer:

// here is code in java.

import java.util.*;

//class defintion

class Main

{

// main method of class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input

       Scanner s=new Scanner(System.in);

       String passcode;

       System.out.print("please enter the passcode:");

       // read string from user

       passcode=s.nextLine();

       // find first character

       char ch=passcode.charAt(0);

       // find second character

       char ch1=passcode.charAt(1);

       // if first character is alphabet

       if(Character.isLetter(ch))

       System.out.println("Alphabetic at 0:");

       // if second character is alphabet  

      else if(Character.isLetter(ch1))

       System.out.println("Alphabetic at 1:");

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create a scanner class object to read input from user.Read 2-character string

from user.Find the each character and check if it is a alphabet or not.If First

character is alphabet then print "Alphabetic at 0:" else if second character

is alphabet then print "Alphabetic at 1:".

Output:

please enter the passcode:b2

Alphabetic at 0:

You might be interested in
How do computers perform complicated tasks built from simple instructions?
wlad13 [49]
They use and perform a set of actions and programs that build on each other.
8 0
4 years ago
A network administrator is designing a new network infrastructure that includes both wired and wireless connectivity. Under whic
Ganezh [65]

Wireless connectivity is recommended for use with laptops or mobile devices, especially as newer devices are less likely to have ethernet connectivity built in. In either case, use of wireless technology make it easier for users to move around without having to worry about being plugged in. Wired connections are still recommended for anything that doesn't need to be able to move as it is generally more reliable, and depending on the devices involved, could offer a faster connection.

7 0
3 years ago
Insurance can help you:
Scorpion4ik [409]
Hello,

Here is your answer:

The proper answer to this question is that insurance can help you..."recover something that was damaged or loss." For example if your vehicle gets damage insurance helps you fix it or if your home gets robbed insurance will help you get your things back!

If you need anymore help feel free to ask me!

Hope this helps!
6 0
4 years ago
Which of the following artists was a pioneering American cartoonist and animator who inspired Walt Disney?
Troyanec [42]
Winsor McCay inspired Walt Disney. He also inspired Bill Watterson, the author of the Calvin and Hobbes comic books.
6 0
3 years ago
Read 2 more answers
Which describes the open-content method of publishing used by sites such as Wikipedia? A. Subscribers must pay for the ability t
valkas [14]
 The correct answer is B. I used d and got it wrong 
3 0
3 years ago
Read 2 more answers
Other questions:
  • Let's write a simple markdown parser function that will take in a single line of markdown and be translated into the appropriate
    10·1 answer
  • How many values will the user submit each time this form is used? Color: RedBlueGreen Quantity:
    10·1 answer
  • Describe how place value is used in the binary number system. How is it similar or different from the way place value is used in
    10·1 answer
  • Explain why binary codes are used to represent characters, numbers and symbols :)
    8·2 answers
  • 11.19 (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an excepti
    6·1 answer
  • A user has requested a field that counts the number of child records associated with a custom object. These custom objects have
    5·1 answer
  • The documents created in ms-excel is call what?​
    11·2 answers
  • Draw the resistor’s voltage and current phasors at t=15ms. Draw the vectors with their tails at the origin. The orientation of y
    5·2 answers
  • Consider a distributed denial of service (DDOS) attack, Assume the attacker has compromised a number of broadband connected comp
    9·1 answer
  • Discuss the objectives of business 8 marks​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!