Question
Need to write the next method in this Java program which handles ROT13 conversion of 5 strings. The next method is supposed take one char
Need to write the next method in this Java program which handles ROT13 conversion of 5 strings. The next method is supposed take one char value as a parameter and convert it to its appropriate ROT13 equivalent. The return value should be the new ROT13 char equivalent. This method IS NOT supposed to do any output itself. It's parameter is a character to convert as a char. Here is what I have so far. Have NOT learned techniques such as StringBuilder or strbuild.append so please don't use that. Really just need help with setting this particular method up, not the entire program.
import java.util.Scanner; public class ROT13Array { private static Scanner input = new Scanner ( System.in ); public static void main ( String args[] ) { String[] sentences = new String[5]; getSentences ( sentences ); displayOriginal ( sentences );
}
/** getSentences from user * * This method allows the user to enter text into each of the * element of the String array that it receives. * * @param sentences An array of String[] data * @return None */ public static void getSentences ( String[] sentences ) { System.out.printf ( " Enter your 5 sentences below: " ); int counter = 1; for ( int x = 0; x < sentences.length; x++ ) { System.out.printf ( "Sentence %d> ", counter ); sentences[x] = input.nextLine(); counter ++; } }
/** displayOriginal * * This method displays all of the elements of the array of String * data that it receives, line by line (element by element). * * @param sentences An array of String[] data * @return None */ public static void displayOriginal ( String [] sentences ) { System.out.println ( " The original text: " ); for ( int x = 0; x < sentences.length; x++ ) { System.out.println ( sentences[x] ); } }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started