Question
This exercises uses the String method toCharArray and a loop to display the letters in the string in reverse order. Write a simple program that
This exercises uses the String method toCharArray and a loop to display the letters in the string in reverse order.
Write a simple program that accepts a phrase as input and reverses the order of the letters and spaces in the phrase. Example Input The rain in Spain falls mainly on the Plain Example Output nialP eht no ylniam sllaf niapS ni niar ehT This may be a great place to use a for loop that decrements instead of increments. Like "for(int d = string.length() - 1; d >= 0; d--)"
What i have so far:
import java.util.*; /** * Date Created: * @author Student name * Filename: ReverseOrder.java */ public class ReverseOrder {
public static void main(String[] args) {
//******** Write your code here ********** } // end main } // end ReverseOrder class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started