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
Alex73 [517]
3 years ago
8

Write method reverseString, which takes a string str and returns a new string with the characters in str in reverse order. For e

xample, reverseString("ABCDE") should return "EDCBA".
Complete the reverseString method below by assigning the reversed string to result.

/** Takes a string str and returns a new string

* with the characters reversed.

*/

public static String reverseString(String str)

{

String result = "";

return result;

}
Computers and Technology
1 answer:
son4ous [18]3 years ago
3 0

Answer:

The method written in Java is as follows:

public static String reverseString(String str){

    String result = "";

    int lentt = str.length();

    char[] strArray = str.toCharArray();

       for (int i = lentt - 1; i >= 0; i--)

           result+=strArray[i];

    return result;

}

Explanation:

This defines the method

public static String reverseString(String str){

This initializes the result of the reversed string to an empty string

    String result = "";

This calculates the length of the string

    int lentt = str.length();

This converts the string to a char array

    char[] strArray = str.toCharArray();

This iterates through the char array

       for (int i = lentt - 1; i >= 0; i--)

This gets the reversed string

           result+=strArray[i];

This returns the reversed string            

    return result;

}

<em>See attachment for full program that includes the main method</em>

Download txt
You might be interested in
A U.S. social security number consists of a string of 9 digits, such as "444422333". Declare a char array named ssn suitable for
tatuchka [14]

Answer:

Since the question expect us to declare a C-string, the solution code is written in C as follows:

  1.    char ssn[9];
  2.    scanf("%s",ssn);

Explanation:

A C-String is a string written in C language. It is an array of characters. To declare a C-string, we use the keyword, <em>char </em>and then followed with the variable name + brackets and the number of characters in the string. For example, we can create a C-String for the SSN number as in Line 1.

To read standard input into the array, we can use C built-in function, <em>scanf(). </em>Just include a string placeholder, %s, and the variable<em> ssn </em>as arguments to <em>scanf()</em>. This will assign the string input by user to variable <em>ssn</em> as C-String.

8 0
3 years ago
Please help me ASAP
jeka57 [31]

Answer:

Troubleshooting

Explanation:

These actions are called troubleshooting.

Troubleshooting is used to diagnose the unexpected error while you are performing some action on the computer. For example

You are running skype, and a one-day mic or sound performing unexpected error. What will you do? You have to perform the troubleshooting for MIC and sound to diagnose the problem.

During troubleshooting, you will wizard through steps of the procedure to diagnose the problem step by step. If the problem will be identified, the solution will be suggested.

You may experience sometimes your Wifi router at home not working. For this to identify the unexpected error you will perform the troubleshooting.

In short, troubleshooting is used to diagnose unexpected error while performing some action on the computer. If troubleshooting does not work, then close all the programs running on your machine, then shut down your computer. Wait a couple of minutes, and then start your computer and see, the problem may have been alleviated.  

3 0
3 years ago
Which of the following has likely attended vocational school?
JulsSmile [24]

C- A graphic designer is the awnser

7 0
3 years ago
Many professional photographers take pictures of people. What skills would someone have to have to be successful in these types
Galina-37 [17]
Wedding photographer
you are taking pictures of large groups of all kinds of people from 2 different sides of a family 

could you add me as best answer if this is correct?

7 0
3 years ago
Parameters are treated as variables within a function.
Amanda [17]

Answer:

In C programming you can only pass variables as parameter to function.

Explanation:

3 0
3 years ago
Other questions:
  • I. Given the following Java code fragment, what is output? int a, b; String c, d, e; String x = new String("I LOVE"); String y =
    14·1 answer
  • How do you get 99 points on sunny meadows simulation?
    6·2 answers
  • What is the energy conversion of solar water heaters?
    12·1 answer
  • Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A
    5·1 answer
  • The benefits of flextime include:
    11·2 answers
  • You work in a classified environment where Bell LaPadula MLS (Multilevel Security) model is employed. Your clearance is "SECRET"
    5·1 answer
  • What is the definition of posture<br>​
    7·1 answer
  • Which is the fastest memory in computer​
    9·2 answers
  • Koi jinda hei kya hello​
    13·2 answers
  • I need help with my work
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!