Skip to content

Instantly share code, notes, and snippets.

@jlmferreira
Created July 20, 2012 16:34
Show Gist options
  • Save jlmferreira/3151714 to your computer and use it in GitHub Desktop.
Save jlmferreira/3151714 to your computer and use it in GitHub Desktop.
The Decoder - Complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this si
import java.util.Scanner;
public class Decoder {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
String code = scan.next();
String tempCode = new String();
int cc;
char ccc = 0;
for (int i = 0;i<code.length();i++){
cc =Integer.valueOf(code.charAt(i)-7);
ccc = (char) cc;
tempCode+=ccc;
}
System.out.print(tempCode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment