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

 

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

Write a method called encode that accepts a String of 26 upper-case letters and a char containing an upper-case letter. The method returns the encoded version of the char. The encoding works by finding the letter in the String that corresponds to the alphabetical position of the char in the alphabet. Use the letter at that location in the String as the encoded version of the char. This is a simple replacement code.


encode("THEQUICKBROWNFOXJUMPEDOVER", "P") → "X"
encode("ABCABCABCABCABCABCABCABCAB", "M") → "A"
encode("BCDEFGHIJKLMNOPQRSTUVWXYZA", "J") → "K"

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

public String encode(String code, char ltr) { }

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

Copyright Nick Parlante 2017 - privacy