id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2021_11_18_APSLHL_altCase
prev  |  next  |  chance

Write a method that returns the string 'str' but with alternating capitalization. It doesn't matter what capitalization 'str' starts out with. You must return 'str' with the first letter capitalized, the next letter lower case, then capitalized, then lower case, then capitalized, etc. Do not change any special symbols or characters, but they DO count as part of the alternating. So "Hi there!" becomes "Hi tHeRe!". The space WOULD have been capitalized, except that it is not a letter so it was left unchanged. Remember that you can use the .toUpperCase and .toLowerCase methods on strings or substrings. Look at the test data for examples.


test2021_11_18_APSLHL_altCase("") → ""
test2021_11_18_APSLHL_altCase("x") → "X"
test2021_11_18_APSLHL_altCase("Y") → "Y"

...Save, Compile, Run (ctrl-enter)

public String test2021_11_18_APSLHL_altCase(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 240

Copyright Nick Parlante 2017 - privacy