Question

In Java or C or even pseudo With a given string reverse every word with a...

In Java or C or even pseudo

With a given string reverse every word with a capital letter and everything in parentheses.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

public class reverseWord
{
public static void main(String[] args)
{
   String input = "Welcome to Reverse String";
   System.out.println("Input String : " + input);
   String reverseString = reverseWord(input);
   System.out.println(reverseString);
}


public static String reverseWord(String str)
{
   String[] arrayword = str.split(" ");
   String reversedString = "";
   for (int i = 0; i < arrayword.length; i++)
{
String eachword = arrayword[i];
String reverseWord = "";
for (int j = eachword.length()-1; j >= 0; j--)
   {
       reverseWord = reverseWord + eachword.charAt(j);
   }
   reversedString = reversedString + "(" + reverseWord.toUpperCase() + ")" + " ";
   }
  
   return reversedString;
}

}

Add a comment
Know the answer?
Add Answer to:
In Java or C or even pseudo With a given string reverse every word with a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT