Advertisement
ConnorSiebens

AthroughZ

Apr 24th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class AthroughZ {
  3.  
  4.     /**
  5.      * @ConnorSiebens
  6.      */
  7.     public static void main(String[] args) {
  8.         Scanner keyboard = new Scanner(System.in);
  9.         char[] letters = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','v','w','x','y','z'};
  10.         int i;
  11.         int[] code = new int[20];
  12.         int codes = 0;
  13.         int readCode;
  14.         System.out.println("Type a word using the integer values. -1 to exit.");
  15.         System.out.println("Can't exceed 25, 0=a, 25=z.");
  16.         readCode = keyboard.nextInt();
  17.         while(readCode != -1){
  18.             code[codes++] = readCode;
  19.             System.out.println("Enter your code. -1 to exit");
  20.             System.out.println("Can't exceed 25, 0=a, 25=z.");
  21.             readCode = keyboard.nextInt();
  22.         }
  23.         for (i=0;i<codes;i++){
  24.             System.out.println(letters[code[i]]);
  25.         }
  26.        
  27.         keyboard.close();
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement