Question: Need help with the next step of a Java program that converts 5 strings to ROT13 encryption. Next I need to write a method which
Need help with the next step of a Java program that converts 5 strings to ROT13 encryption. Next I need to write a method which takes one char value as a parameter and converts it to its appropriate ROT13 equivalent. The return value should be the new ROT13 char equivalent. The method does not do any output. It's parameter is a character to convert as a char. Here is what I have so far.
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
Get step-by-step solutions from verified subject matter experts
