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
What are the syntax of c programming language?
user100 [1]

the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.

The syntax of the C programming language, the rules governing writing of software in the language, is designed to allow for programs that are extremely terse, have a close relationship with the resulting object code, and yet provide relatively high-level data abstraction. C was the first widely successful high-level language for portable operating-system development.

8 0
2 years ago
Which lighting technique can often heighten a dramatic story?
Elina [12.6K]

Answer:

side or back lighting

Explanation:

big brain

6 0
3 years ago
Refer to Table 8-4. Consider the data above (in billions of dollars) for an economy: Gross domestic product (in billions of doll
Whitepunk [10]

If one uses the data above (in billions of dollars), the Gross domestic product (in billions of dollars) for this economy equals  $1,200.

<h3>What is the GDP about?</h3>

Note that:

GDP (Gross Domestic Product):

Thus it will be :

Consumption + Investment + Government expenditure + (Export - Import)

Which is:

GDP = 800 + 200 + 300 + (100 - 200)

GDP = $1200 billions

See full question below

Consumption expenditures $800

Investment expenditures 200

Government purchases 300

Exports 100

Imports 200

Wages 800

8) Refer to Table above. Consider the data above (in billions of dollars) for an economy: Gross domestic product (in billions of dollars) for this economy equals

A) $2,200.

B) $1,600.

C) $1,400.

D) $1,200.

Learn more about GDP from

brainly.com/question/1383956

#SPJ1

6 0
1 year ago
Explain briefly how learning how to follow can make a person a good leader
Masja [62]

By  learning how to follow, one can  be a good leader because: Looking up to a leader and following them help to:

  • Keep one's ego in check and one can be able to be a good ego manager.
  • They create strong credibility.
  • They help use to focus our efforts for maximum impact.

<h3>How does being a good follower make you a good leader?</h3>

As a good follower, a person can be able to have the boldness and confidence to be able to respectfully talk about a lot of things with their leader if you see that you're not going in the right way.

Note that  one can trust your leader and this will boast up the spirit of your input and engagement in all.

Hence, By  learning how to follow, one can  be a good leader because: Looking up to a leader and following them help to:

  • Keep one's ego in check and one can be able to be a good ego manager.
  • They create strong credibility.
  • They help use to focus our efforts for maximum impact.

Learn more about good leader from

brainly.com/question/12522775

#SPJ1

3 0
1 year ago
One of the difficult decisions a systems analyst has to make when it comes to software is whether to recommend making, buying, o
Mademuasel [1]

Answer:

Explanation:

There are different advantages to buy commercial software like:

- Is a system used for other companies, we will have good referents with the feedback of them.

- Support, we should have support twenty-four hours, if a system doesn't have good support, we must not buy the software.

- We can choose software with a lower initial cost, this depends on our needs.

3 0
2 years ago
Other questions:
  • After doing the route tracing to a particular IP addresses, paste the path of IP addresses that were taken from your IP address
    13·1 answer
  • An iPad Is An Example Of Which Type Of Computer?
    11·2 answers
  • Which is the process that a wireless router uses to translate a private ip address on internal traffic to a routable address for
    14·1 answer
  • Assume that LO and HI have already been assigned as constants with LO &lt; HI, and x has been declared as DWORD in the data segm
    7·1 answer
  • All of the following are challenges presented by changing technology as it relates to the special events field EXCEPT: A. the ab
    13·1 answer
  • Blank includes websites that encourage interaction and connection among people businesses and organizations
    14·2 answers
  • Which os the following is NOT true about the proof of work concept?
    8·1 answer
  • The __________ operator increases the value of the variable by 1 after the original value is used in the expression in which the
    7·1 answer
  • What Microsoft feature enables you to represent text as colorful visuals
    12·1 answer
  • 70 point Brainlist to best answer
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!