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
Yuki888 [10]
2 years ago
7

Fun with Characters

Computers and Technology
1 answer:
Inessa [10]2 years ago
4 0

The program is an illustration of conditional statements.

Conditional statements are statements whose execution is dependent on the truth value of the condition.

The checkCharacter() method in Java, where comments are used to explain each line is as follows:

//This defines the checkCharacter() method

public static String checkCharacter(String inputString, int index){

  //This checks if the character at the index, is a digit

  if(Character.isDigit(inputString.charAt(index))){

      //If yes, it returns "Digit"  

      return "Character "+inputString.charAt(index)+" is a digit";

  }

  //This checks if the character at the index, is a letter

  else if(Character.isLetter(inputString.charAt(index))){

      //If yes, it returns "letter"

      return "Character "+inputString.charAt(index)+" is a Letter";

  }

  //This checks if the character at the index, is a white space

  else if(inputString.charAt(index) ==' '){

      //If yes, it returns "white space"

      return "Character "+inputString.charAt(index)+" is a white space";

  }

  #If all the above conditions are false

   else{

      //If yes, it returns "unknown character"

      return "Character "+inputString.charAt(index)+" is an unknown character";

  }

}

The string to return depends on the character at the index.

Read more about similar programs at:

brainly.com/question/25127567

You might be interested in
Digital rights include the right to
faltersainse [42]
D. Speak your ideas with respect on the internet .
7 0
2 years ago
What is the Is option that prints the author of a file​
sleet_krkn [62]

Answer:

Print.. is your answer...

4 0
3 years ago
What refrigerant has been approved for new household refrigerators and freezers
Alexxx [7]
Bsbsnsnsnsn jajwjemoeododhdhdw whajsjshtzzvsssnxbba. 3
8 0
3 years ago
Reference variables allow arguments to be passed by ____________.
son4ous [18]

Answer:

Reference

Explanation:

The Reference type variable is such type of variable in C# that holds the reference of memory address instead of value. Examples for reference type are classes, interfaces, delegates and arrays.

We can pass parameters to the method by reference using <em>ref </em>keyword

It’s mandatory to initialize the variable value before we pass it as an argument to the method in c#

For example,

int x = 10;  // Variable need to be initialized

Add(ref x); // method call

If you pass parameters by reference in method definition, any changes made to it affect the other variable in method call.

Here's a sample program:

using System;

namespace ConsoleApplication

{

   public class Test

   {

       public static void Main()

       {

           int i = 10;

           Console.WriteLine("i=" + i);

           Add(ref i);

           Console.WriteLine("i=" + i);

           Console.ReadLine();

       }

       public static void Add( ref int j)

       {

           j = j + 10;

           Console.WriteLine("j="+j);

       }

   }

}

Output:

i=10

j=20

i=20

7 0
3 years ago
Pleeeese help me for these questions
geniusboy [140]

1 Account

2 online

3 access

4 password

5 internet

6 email

4 0
3 years ago
Other questions:
  • Which of the following characteristics relates to authentication header (AH)? It is a document that defines or describes compute
    11·1 answer
  • Upgrading only the motherboard will give some performance improvement to a computer system. Why would the improvement be limited
    14·1 answer
  • Is the cell phone changing our views about polite and impolite behavior? For example,
    15·2 answers
  • 6. A distribution consists of three components with frequencies 200, 250 and 300 having means
    14·1 answer
  • A _____ defines what must take place, not how it will be accomplished.​
    12·1 answer
  • Seth is researching new developments in cancer treatments. Which suggestion would be most beneficial to making sure his search r
    14·1 answer
  • A______ is a graphical representation of numeric data.
    8·1 answer
  • Which of the following is a valid c++ identifier a. mouse b. _int c. 2_stop d. float​
    10·1 answer
  • The software concept ___________and defines a need for the new system.
    6·1 answer
  • 1. Give one reason why data is represented in binary in a computer [1]
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!