In Java Please

4.24 LAB: Print string in reverse
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text.

Ex: If the input is:

Hello there
Hey
done
the output is:

ereht olleH
yeH

Answers

Answer 1

The program that takes in a line of text as input, and outputs that line of text in reverse is given

The Program

import java.util.Scanner;

public class ReverseString {

  public static void main(String[] args) {

       Scanner input = new Scanner(System.in);

       String line;

       do {

           line = input.nextLine();

           if (!line.equalsIgnoreCase("done") && !line.equalsIgnoreCase("d")) {

               String reversed = reverseString(line);

              System.out.println(reversed);

           }

       } while (!line.equalsIgnoreCase("done") && !line.equalsIgnoreCase("d"));

   }

  public static String reverseString(String text) {

       StringBuilder reversedText = new StringBuilder();

       for (int i = text.length() - 1; i >= 0; i--) {

           reversedText.append(text.charAt(i));

       }

       return reversedText.toString();

   }

}


Read more about programs here:

https://brainly.com/question/30783869

#SPJ1


Related Questions

Describe any special considerations unique to Oracle that must be addressed?

Answers

When working with Oracle, there are a few special considerations that must be addressed:

1. Licensing: Oracle has specific licensing requirements, and it's important to ensure compliance with their licensing policies. This includes understanding the licensing models, user licenses, and potential costs associated with Oracle products.

2. Performance Tuning: Oracle databases require careful performance tuning to optimize their efficiency. This involves monitoring and adjusting various parameters, such as memory allocation, disk I/O, query optimization, and indexing strategies.

3. High Availability and Disaster Recovery: Implementing robust high availability and disaster recovery solutions is crucial for critical Oracle systems. This may involve using technologies like Oracle Real Application Clusters (RAC), Data Guard, or GoldenGate to ensure data availability, minimize downtime, and support business continuity.

4. Security: Oracle databases store sensitive data, so implementing strong security measures is essential. This includes setting up proper access controls, authentication mechanisms, encryption, auditing, and regularly applying security patches and updates.

5. Oracle-specific Features: Oracle offers a wide range of advanced features and functionalities that may require specific considerations. These include partitioning, advanced analytics, Oracle Advanced Compression, Oracle Enterprise Manager, and more. Understanding and leveraging these features can enhance the performance and capabilities of Oracle systems.

It's worth noting that the specific considerations may vary based on the version and edition of Oracle being used, as well as the specific requirements of the project or organization.

How would you rate this answer on a scale of 1 to 5 stars?
Other Questions
What do you think is the importance of the evolution of media to our everyday lives?. Below you will find pairs of statements A and B. For each pair, please indicate which of the following three sentences are true and which are false: - If A, then B - If B, then A. - A if and only B. (a) A: Polygon PQRS is a rectangle. B : Polygon PQRS is a parallelogram. (b) A: Joe is a grandfather. B : Joe is male. For the remaining items, x and y refer to real numbers. (c) A:x>0B:x 2>0 (d) A:x In our solar system, what are the planet(s) known to have liquid water actively stable on the surface? A. Earth B. Mars and Jupiter C. Two of these answers are correct D. Earth and Mars Which of the following are e-commence models? i. Business to business ii. Business to government iii. Business to consumer iv. Consumer to consumera.(i); (iii); and (iv)b.(ii); (iii); and (iv)c.(i); (ii); and (iii)d.(i); (ii); (iii); and (iv For each of the following distributions show that they belong to the family of exponential distributions: a. f(x;)= 2xe 2 2x 2,x0,>0 b. f(x;)= 1 xloglog(),0 Which function does NOT have a range of all real numbers? f(x)=3 x f(x)=-0.5 x+2 f(x)=8-4 x f(x)=3 when the auditors select a sample from the vouchers payable register at the end of the period and trace the items to underlying documents, the auditors are gathering evidence primarily to support that: Which of the following does NOT accurately describe what we mean when we say that language is personal?- We each have different vocabularies.- We develop our own expressions to describe our own reality- We each have developed language without the influence of our age, gender, or personality- We have different levels of experience that limit or expand our capacity to communicate ideas and things if a licensee sells a property he/she owns without another licensee involved and writes the terms of the agreement accepted by the purchaser a(n) ____ company maintains its management and business operations in its home country while exporting products to or importing products from other countries. Slove the system of linear equations, Separate the x and y values with a comma. 11x=56-y 3x=28+y What is the electron configuration and lewis structure of { }_{49} In? What is the electron configuration and lewis structure of { }_{49} {In}^{-5} ? [A Revinit Later How to Artempt? Series Problem A giver series could be in Arittmetic Prog ession a Geometric Progression or a Fanonaco sevies Kou wil be provided with N numbers and your tank is fo first decide Which bpe of series it ia and then find out the next number in that series. Input Specification irput1: An meger viboe N dissoting the length of the array ingutet An ineeger ariay denotiong the valus of the series. Output Specification: Eample-1: inpertiss inpert2t i1.1.2.1.5! the first to articulate the notion of natural law--the doctrine that human affairs should be governed by certain ethical principles--was The following data set shows the number of books checked out from a libraryduring the first two weeks of the month:19, 10, 15, 99, 12, 18, 15, 16, 12, 13, 18, 17, 19, 13Which of the following statements is true based on the data set?O There is one outlier, indicating very few books were checked out on that day.O There is one outlier, indicating an abnormally large number of books were checkedout on that day.O There are two outliers, indicating very few books were checked out on those twodays.O There are two outliers, indicating an abnormally large number of books were checkedout on those 2 days. lostridium difficile Case Study 24-year-old woman suffered from recurrent severe episodes of an intestinal disorder called Clostridium difficile infection (CDI) for past 13 months. She routinely experienced profuse watery diarrhea, abdominal pain, and fever. In addition, she was feeling tired and hopeless because she did not seem to be gettering well, despite long attempts at multiple different treatments. As with most patients who have CDI, the woman had been taking an oral antibiotic shortly before her symptoms began - in this case to treat a tooth infection. The antibiotic had successfully killed that bacteria but caused her tooth infection, but it also killed some members of her normal intestinal microbiota. As a result, the bacterium Clostridium difficile - often referred to simply as "C. diff" thrived in her intestinal tract, growing to much higher numbers than it could before. The strain that causes her infection was able to make a toxin that damaged the lining of her intestinal tract. When the patient first started experience CDI, her doctor told her to stop taking the antibiotic prescribed for her tooth infection, hoping that her CDI would resolve on its own. When that did not help, the doctor prescribed a different antibiotic that is often effective in treating CDI. The patient started feeling better, but the symptoms quickly returned when she stopped taking the medication. She also tried oral supplements containing Lactobacillus GG, a bacterium that sometimes appears to be effective in preventing antibiotic associated diarrhea. Because that patient's health was declining, doctors suggested a fecal transplant, p procedure that involves in inserting feces from a healthy person into the patient's intestinal tract in order to repopulate that environment with appropriate microbes. The chose to use her sister as a fecal donor, screening both the donor and the patient to ensure that neither was infected with certain infectious agents, including various intestinal pathogens and HIV. Approximately Y cup of fresh feces was mixed with 1 quarter of water and delivered to her intestinal tract via a colonoscope. Within days after the transplant, the patient began feeling better, and soon recovered completely. 1. Why would certain oral antibiotics allow Clostridium difficile thrive in the intestinal tract? 2. Why would the doctors screen both the patient and the decal donor for certain infectious agents? 3. Why would the doctors transplant feces rather than introducing isolated bacteria from feces to repopulate You have been contracted to create a computerized records management information system fora tertiary level education institution or a major hospital. You have already identified thestakeholders of the project and collected requirements for the project.1. Propose a Problem/Opportunity Statement.2. Present components of your Scope Statement to includea. project scope description.b. deliverablesc. state acceptance Criteriad. list any exclusions (if applicable)3. Use Deliverables to create a Work Breakdown Structure:a. Product orientedb. Outline viewc. Graphical view4. Create an Activity List of 7 items from the work packages identified in item 3. Support Ideas with Evidence By the early 1880s, the Standard Oil Trust controlled more than 90 percent of the oil refining business in the United States. Was Standard Oil a natural monopoly? Why or why not?Support Ideas with Examples What is one industry or firm that probably has economies of scale, and how do those economies of scale affect it? Angel rented a car and drove 300 miles and was charged $120, while on another week drove 560 miles and was charged $133. Use miles on the horizontal ax and cost on the vertical axis (miles, cost). Crane Dish Printery publishes the best-selling Coptoin Cajur Cookbook that sells for \( \$ 7 \). The company incurs variable costs of \( \$ 2 \) per cookbook and total foed costs are \( \$ 326,700 \)