Question: Create a program that encodes messages. The messages will be encoded by using a shift that will be given to you. This shift number can
Create a program that encodes messages. The messages will be encoded by using a shift that will be given to you. This shift number can be positive, negative, or zero and has no size limit. Here is a stub to get you started:
public class Problem23 { public static void main(String[] args) { System.out.println(encodeMessage("I LOVE JAVA", 4)); // M PSZI NEZE System.out.println(encodeMessage("ZABCDEFGHIJKLMNOPQRSTUVWXY", -19)); // GHIJKLMNOPQRSTUVWXYZABCDEF System.out.println(encodeMessage("I GOT TO THIS POINT ON MY OWN!", 235)); // J HPU UP UIJT QPJOU PO NZ PXO! } public static String encodeMessage(String phrase, int shift) { // Your code here } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
