hey im working on this program that shifts the Unicode value by the users choice but somewhere in my code there is a error and i can't find it when you attempt to shift it adds 2 letters and when i attempted to fix that it shifted wrong on the 5 spaces this is my last assignment for the semester and i would really like to get it out of the way to help program for a robot convention heres the code
import java.util.Scanner; public class EncoderDecpder { private static void messageEncoder() { System.out.println ("Enter the message you want to encode"); Scanner sc = new Scanner(System.in); String message = sc.nextLine(); System.out.println("what number would you like to decode number to be: "); int shift = sc.nextInt(); // encodes message for (int loop = 0;loop < message.length();loop++) { //int encoderCh= (int)message.charAt (loop); char tempString = message.charAt(loop); char replaceChar = (char)((int)(tempString + shift)); message.replace(tempString, replaceChar); System.out.print(replaceChar); // System.out.println(); // System.out.print(tempString); } System.out.println("to decode run the number: "+shift+" through the decoder"); } private static void messageDecoder() { /* * Need to finish encoder before starting decoder * */ } public static void main(String[] args) { boolean end = false; do { Scanner command = new Scanner(System.in); System.out.println ("COMMAND MENU\n1:Message Encoder\n2:Message Decoder\n3:Termanate Program"); int menuChoice = command.nextInt(); if (menuChoice == 1) {messageEncoder();} if (menuChoice == 2) {messageDecoder();} if (menuChoice == 3) {end = true;} }while(end == false); } }