StringReverser
Given the following code that creates a Scanner and gets a String from the user, finish the code so that the program will:
Output the provided String, input, backwards
Note that the answer should be one phrase - the reverse of input.
The use of an additional method is optional.
SAMPLE OUTPUT
======================
Enter a word or phrase:
this is a test
REVERSED:
tset a si siht

Answers

Answer 1

Answer:

Explanation:

The following code is written in Java, it uses the scanner import to take in a string from the user. Then it uses the string builder import to use the input string and reverse it. Finally outputting the reversed string. The output can be seen in the attached picture below.

import java.util.Scanner;

class Brainly

{

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a string: ");

       String answer = in.nextLine();

       StringBuilder sb=new StringBuilder(answer);

       sb.reverse();

       System.out.println("Reversed: \n" + sb.toString());

   }

}

StringReverserGiven The Following Code That Creates A Scanner And Gets A String From The User, Finish

Related Questions

In the following cell, we've loaded the text of Pride and Prejudice by Jane Austen, split it into individual words, and stored these words in an array p_and_p_words. Using a for loop, assign longer_than_five to the number of words in the novel that are more than 5 letters long. Hint: You can find the number of letters in a word with the len function.

Answers

Answer:

Explanation:

Since the array is not provided, I created a Python function that takes in the array and loops through it counting all of the words that are longer than 5. Then it returns the variable longer_than_five. To test this function I created an array of words based on the synapse of Pride and Prejudice. The output can be seen in the attached picture below.

def countWords(p_and_p_words):

   longer_than_five = 0

   for word in p_and_p_words:

       if len(word) > 5:

           longer_than_five += 1

   return longer_than_five

what are the events?

Answers

Answer:

a thing that happens or takes place, especially one of importance.

Using a loop and indexed addressing, write code that rotates the members of a 32-bit integer array forward one position. The value at the end of the array must wrap around to the ?rst position. For example, the array [10,20,30,40] would be transformed into [40,10,20,30].

Answers

Answer:

//begin class definition

public class Rotator{

    //main method to execute the program

    public static void main(String []args){

       

       //create and initialize an array with hypothetical values

       int [] arr =  {10, 20, 30, 40};

       

       //create a new array that will hold the rotated values

       //it should have the same length as the original array

       int [] new_arr = new int[arr.length];

       

       

       //loop through the original array up until the

       //penultimate value which is given by 'arr.length - 1'

      for(int i = 0; i < arr.length - 1; i++ ){

           //at each cycle, put the element of the

           //original array into the new array

           //one index higher than its index in the

           //original array.

          new_arr[i + 1] = arr[i];

       }

       

       //Now put the last element of the original array

       //into the zeroth index of the new array

       new_arr[0] = arr[arr.length - 1];

       

       

       //print out the new array in a nice format

      System.out.print("[ ");

       for(int j = 0; j < new_arr.length;  j++){

           System.out.print(new_arr[j] + " ");

       }

       System.out.print("]");

       

    }

   

   

}

Sample Output:

[ 40 10 20 30 ]

Explanation:

The code above is written in Java. It contains comments explaining important parts of the code.  A sample output has also been provided.

Whatever programming language you use will ultimately need to be translated into binary in order for the computer to understand it.

a. True
b. False

Answers

Answer:

Javascript:

function translate(what) {

if (what) {

return 1;

} else if (!what) {

return 0;

}

}

translate(true);

Explanation:

True is 1;

False is 0;

Other Questions
33%The diagram shows a square ABDE and an isosceles triangle BCD.Angle C = 40Work out the size of angle EBC.B40E Um gato come 5 ratos por dia. Quantos ratos 5 gatos comem em 5dias? A milk-dairy produces 25,545 litres of milk every day. It supplies 15,625 litres of milk to a milk-depot and rest to the market. How much milk is supplied to the market ? All of the following are true about the 1876 Texas Constitution EXCEPT:a.It is still in use todayb.It has never been amendedc.It originally did not include the rights of African Americansd.It severely limits the power of the state government Please help Apply your knowledge and understanding of equilibrium constant in solving the following problems:The equilibrium constant Kc for the reaction below is 170 at 500 K.Determine whether the reaction mixture is at equilibrium when the concentrations of the components at this temperature are as follows:[N2]=1.50[H2]=1.00[NH3]=8.00If it is not at equilibrium, state and explain in which direction the reaction will proceed.Multi Line Text.2()+32() 23() The Model Penal Code IS a source of Criminal Law. True or false Move this lichento where it belongs within the process of primary successionPls help 15 points vectorsp=(4,3) and q=(-2,7), find 4p -2q B) Una empresa A gana S/ 42 758,35 en un ano. Si la empresa B gastara S/ 8774,55; tendria tantas ganancias como la primera empresa. Cual es la ganancia total de la empresa B? The average of Blanca's first three test scores was 90. The average of her next two test scores was 95. What was the average of Blanca's first five test scores? will give brainliest and 50 pointsGiven the inequality -8 < 2, explain what happens when you multiply or divide both sides by 2 and what happens when you multiply or divide both sides by -2. "At all events I assure you I don't waste money unprofitably. But I can't find it in my heart to deny myself the pleasure of entertaining my friends. I need that sort of thing,you know. I have lived for so long shut out of it all, that it is a necessity of life to me to mix with young, eager, ambitious men, men of liberal and active minds;:"(Dr. Stockman) aDr. Stockman is only concerned about having a good time and not about the welfare of the people bDr. Stockman is a man that needs people around him who approve of and love him cDr. Stockman is essentially a hermit at heart but must entertain people he is to be accepted in the community dDr. Stockman wants eager minds around him so they can do his work for him heyy! ill give brainliest please help. A pinwheel's four blades are all congruent right trapezoids.4 in2 in2 inWhat is the combined area of the four blades, in square inches? 0.326 as a fraction Whatever programming language you use will ultimately need to be translated into binary in order for the computer to understand it.a. Trueb. False The cone and the sphere have the same volume. The diameter of the cone is 24 cm, and the diameter of the sphere is 18 cm.What is the HEIGHT of the CONE? Use 3.14 Mrs. Fox met with 120 students. If three- quarters were girls, how many boys were at the meeting Pls Im begging my soul Olivia plays lacrosse three times a week on her club team. She wants to improve how hard she shoots the ball. Which skill-related component is most important?powero flexibilitycoordinationO maximum strength