- #1
crimsondarkn
- 13
- 0
Here's what I wrote , but there's no output.. It is suppose to read a line typed from the user and enter whatever the input was with the letter after the ones inputted. please help
import java.util.Scanner;
class ProblemS2 {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args){
System.out.print("Input the word:");
String code =sc.next();
System.out.println("Time to decipher this...");
char c;
char[] letteroutput = { 'A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for(int i=0;i<code.length();i++) {
c = code.charAt(i);
for(int j=0; j <letteroutput.length; i++) {
if(letteroutput[j]==c)
System.out.println(letteroutput[j+1]);
else
break;
}
}
}}
import java.util.Scanner;
class ProblemS2 {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args){
System.out.print("Input the word:");
String code =sc.next();
System.out.println("Time to decipher this...");
char c;
char[] letteroutput = { 'A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for(int i=0;i<code.length();i++) {
c = code.charAt(i);
for(int j=0; j <letteroutput.length; i++) {
if(letteroutput[j]==c)
System.out.println(letteroutput[j+1]);
else
break;
}
}
}}