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

 

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

Write a method that translates 'msg' into "code words" that represent each letter. The string 'msg' will be a message that only includes letters, with no punctuation, spaces, etc. The string 'codes' will be all the codes in alphabetical order with the first letter of each code capitalized and indicating what letter the code is for. There will also be a space between each code. As preconditions you may assume that 'msg' only contains letters (possibly uppercase and/or lowercase). You may also assume that 'codes' has a code for each letter and that those codes are in alphabetic order. Uppercase and lowercase letters in 'msg' translate to the same code. For example, if the code for "f" is "foxtrot", then both "F" and "f" translate to "foxtrot". Look at the test data for examples. You ARE allowed to use String methods. You ARE allowed to look up the Java API for String methods! Note also that 'codes' will have a space at the end of the string after the last code and so will the string you return as your result.


test2021_12_15_HL_codeTalk("LostInSpace", "Art Boat Car Deer Elephant Flea Ghost Happy Ice Joust Kangaroo Laugh Mouth Nice Oyster Pearl Quest Rent Soup Tan Umbrella Volt Walrus Xbox Yellow Zebra ") → "Laugh Oyster Soup Tan Ice Nice Soup Pearl Art Car Elephant "
test2021_12_15_HL_codeTalk("thequickbrownfoxjumpedoverthelazydog", "Art Boat Car Deer Elephant Flea Ghost Happy Ice Joust Kangaroo Laugh Mouth Nice Oyster Pearl Quest Rent Soup Tan Umbrella Volt Walrus Xbox Yellow Zebra ") → "Tan Happy Elephant Quest Umbrella Ice Car Kangaroo Boat Rent Oyster Walrus Nice Flea Oyster Xbox Joust Umbrella Mouth Pearl Elephant Deer Oyster Volt Elephant Rent Tan Happy Elephant Laugh Art Zebra Yellow Deer Oyster Ghost "
test2021_12_15_HL_codeTalk("FountainZipLine", "Ant Bat Cat Dog Ear Fat Gin Hat Ice Jan Kin Lot Mat Nab Oat Pit Que Rib Sat Tub Urn Vat Win Xor Yak Zip ") → "Fat Oat Urn Nab Tub Ant Ice Nab Zip Ice Pit Lot Ice Nab Ear "

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

public String test2021_12_15_HL_codeTalk(String msg, String codes) { }

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: 290

Copyright Nick Parlante 2017 - privacy