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
Ns.office.com/Pages/ResponsePage.aspx?id=bd8
bulgar [2K]

Answer:

spreadsheet software

Explanation:

Spreadsheet software is an application that allows users to organize data in columns and rows and perform calculations on the data. These columns and rows collectively are called a worksheet.

6 0
3 years ago
Read 2 more answers
Which of the following is an online library?
Mice21 [21]
Answer A. Hope it helped c:
4 0
3 years ago
Read 2 more answers
Recall that the name of a transport-layer packet is segment and that the name of a link-layer packet is frame. What is the name
AlladinOne [14]

Answer:

A network-layer packet is a data gram. A router forwards a packet based on the packet's IP (layer 3) address. A link-layer switch forwards a packet based on the packet's MAC (layer 2) address.

Explanation:

When the end system receives the unstructured bit stream from the physical wire, each layer removes the header information applicable to it until the application receives the data.

1. An application, such as an email program, creates data that will be sent by an end user, such as an email message. The Application layer places a header (encapsulation) field that contains information such as screen size and fonts, and passes the data to the Presentation layer.

2. The Presentation layer places layer 6 header information. For example, the text in the message might be converted to ASCII. The Presentation layer will then pass the new data to the Session layer (layer 5).

3. The Session layer follows the same process by adding layer 5 header information, such as information that the Session layer will manage the data flow, and passes this data to the Transport layer (layer 4).

4. The Transport layer places layer 4 information, such as an acknowledgement that the segment was received in the header, and passes it to the Network layer (layer 3).

5. The Network layer places layer 3 header information, such as the source and destination address so the Network layer can determine the best delivery path for the packets, and passes this data to the Data Link layer (layer 2).

6. The Data Link layer places layer 2 header and trailer information, such as a Frame Check Sequence (FCS) to ensure that the information is not corrupt, and passes this new data to the Physical layer (layer 1) for transmission across the media.

7. The bit stream is then transmitted as ones and zeros on the Physical layer. It is at this point that the Physical layer ensures bit synchronisation. Bit synchronisation will ensure the end user data is assembled in the correct order it was sent.

8. Steps 1 through 7 occur in reverse order on the destination device. Device B collects the raw bits from the physical wire and passes them up the

Data Link layer. The Data Link layer removes the headers and trailers and passes the remaining information to the Network layer and so forth until data is received by the Application layer. Eventually, Device B will receive an email notification displaying a message to indicate that a new email message has been received.

5 0
3 years ago
What is the most complex part of a PC?
rjkz [21]

Answer:

From a hardware standpoint, the CPU is most likely the main component. From a software standpoint, macOS and Windows are complex software systems.

Explanation:

6 0
2 years ago
Which describes the third step in visual character development
allsm [11]

I would say 3-D model!!!! not 100% sure but this sounds most correct!

5 0
3 years ago
Read 2 more answers
Other questions:
  • With a _____ network connection, the computers and other devices on the network are physically connected via cabling to the netw
    10·2 answers
  • a one-two paragraph summary on the Running Queries and Reports tutorials. Apply critical thinking and an academic writing style
    6·1 answer
  • Preesure is drived quantity? why​
    15·2 answers
  • Name three actions you can perform on an inserted image.
    7·2 answers
  • Refer to the exhibit, a technician applies the configuration in the exhibit to an unconfigured router. To verify the configurati
    13·1 answer
  • I wanna start answering questions for people, but I don't quite know how. Can you help me?​
    13·1 answer
  • Driver’s License Exam The local driver’s license office has asked you to create an application that grades the written portion o
    9·1 answer
  • What are the top ten alternative songs of the 2000's?
    7·1 answer
  • If a employee has a grade grater than or equal to 18, then he she will get 50% bonous on the basic pay. Otherwise, the employee
    5·1 answer
  • Create a text file content.txt and copy-paste following text (taken from Wikipedia) into it: A single-tasking system can only ru
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!