File Processing, programming homework help

User Generated




Write a static method named halfCaps that accepts as its parameter a Scanner holding a sequence of words and outputs to the console the same sequence of words with alternating casing (lowercase, uppercase, lowercase, uppercase, etc). The first word, third word, fifth word, and all other "odd" words should be in lowercase letters, whereas the second word, fourth word, sixth word, and all other "even" words should be in uppercase letters. For example, suppose the Scanner contains the following words.

The QUick brown foX jumPED over the Sleepy student

For the purposes of this problem, we will use whitespace to separate words. You can assume that the sequence of words will not contain any numbers or punctuation and that each word will be separated by one space. For the input above, your method should produce the following output:

the QUICK brown FOX jumped OVER the SLEEPY student

Your output should separate each word by a single space. The output may end with a space if you like. Note that the Scanner may contain no words or may contain an even or odd number of words.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hi! Here ...

Just the thing I needed, saved me a lot of time.


Related Tags