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
Rom4ik [11]
3 years ago
9

Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending whe

n the user enters "Quit", "quit", or "q" for the line of text. in java.
Computers and Technology
1 answer:
OLEGan [10]3 years ago
6 0

Answer:

The solution code is as below:

  1.        Scanner input = new Scanner(System.in);
  2.        System.out.print("Input a string: ");
  3.        String inStr = input.nextLine();
  4.        int strLen = inStr.length();
  5.        while(inStr.equals("Quit") != true && inStr.equals("quit") !=true && inStr.equals("q") != true){
  6.            for(int i= 0; i < strLen; i++){
  7.                System.out.print(inStr.charAt(strLen - 1 - i));
  8.            }
  9.            System.out.println();
  10.            System.out.print("Input a string: ");
  11.            inStr = input.nextLine();
  12.            strLen = inStr.length();

Explanation:

Firstly, we create a Scanner object,<em> input</em> (Line 1).

Next, we use the Scanner object nextLine() method to get a text input from user (Line 3).

We create a while loop and set the condition so long as the input text is not equal to "Quit", "quit" or "q" (Line 6), the program should proceed to print the input text in reverse (Line 8-10). To print the text in reverse, we can apply the expression<em> length of string - 1 - current index</em>.  This will ensure the individual letter is read from the last and print the text in reverse.

Next, prompt the user to input a new text (Line 13-14) and repeat the same process of printing text in reverse so long as the current input text is not "Quit", "quit" or "q".

You might be interested in
Please answer questions in complete sentences!
Troyanec [42]

i need help on that too :cc

7 0
2 years ago
Calvin works as a graphic designer for an advertising company. He has to submit a large number of prints quickly because the dea
choli [55]

Answer:

The correct answer would be, Laser Printers.

Explanation:

There are a lot of printers that are used to print out a document, or file, or image, or anything you want on a paper. Printers are called the output device of the computer system as it is used to get the output from the computer.

The most important types of printers are Laser Printers, Inkjet Printers, Dot Matrix Printers, etc.

Laser printers are considered to be the fastest printers among all. These printers also give a high quality print out in just a blink of an eye. So these printers are used to print documents which are too lengthy and require a quick print out. So Laser printers will help Calvin in meeting his deadline.

6 0
3 years ago
Jane wants to add a chart to her presentation so she’ll click the Insert tab and in the Images group, she’ll click the Chart but
kap26 [50]

(A. Stevie only) because You need to go the illustrations tab in order to click on the chart button.

Jane clicked on images tab so she was wrong.

Mark as brainlest plz :)

3 0
3 years ago
_________ is a hybrid cryptosystem that combines some of the best available cryptographic algorithms and has become the open-sou
Maurinko [17]

Answer:

The correct answer is PGP i.e  "Pretty Good Privacy" .

Explanation:

Pretty Good Privacy is an encryption algorithm that gives the database interaction with the confidentiality and authorization.Pretty Good Privacy is security algorithm which gives the security into the mail . login ,decryption ,encryption are the example of the "Pretty Good Privacy" .

Pretty Good Privacy  is a type of  hybrid cryptosystem that incorporates cryptographic algorithms and it has de facto open source standard for the mail and the file storage .

3 0
3 years ago
You are able to drag a cell to a new location by pointing to the cell border until the pointer displays a _______ arrow, and the
ivann1987 [24]
I think its D, double-headed if I remember right. If this is brainiest can you mark it, please! I am trying to rank up. Thanks, hun!
7 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is NOT an example of input?
    8·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • WHICH OF THE FOLLOWING RANGES OF CELLS IS CORRECTLY NAMED?
    12·1 answer
  • What does lurch mean
    14·2 answers
  • Some websites are dedicated to cataloguing information. Since these sites contain so much data, these sites are usually organize
    11·2 answers
  • True or false? Colons are required when entering the MAC address into the Reservation window?
    14·1 answer
  • Explain the functions of a VDU?
    6·1 answer
  • Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should o
    9·1 answer
  • 2. The Warren Commission investigated the assassination of President _______________________ in 1964.
    6·1 answer
  • Can someone send me reference on communication, importance , communication cycle , pros and cos​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!